Skip to content
Snippets Groups Projects
Commit 74f598cd authored by pabois's avatar pabois
Browse files

filter alumni

parent 2f05db1c
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ class Admin::University::AlumniController < Admin::University::ApplicationContro
through_association: :people
has_scope :for_search_term
has_scope :for_alumni_organization
has_scope :for_alumni_program
has_scope :for_alumni_year
......
......@@ -12,6 +12,13 @@ module University::Person::WithExperiences
validates_associated :experiences
scope :for_alumni_organization, -> (organization_id) {
left_joins(:experiences)
.where(university_person_experiences: { organization_id: organization_id })
.select("university_people.*")
.distinct
}
end
end
......@@ -2,7 +2,12 @@ module Filters
class Admin::University::Alumni < Filters::Base
def initialize(user)
super
add_search
add :for_alumni_organization,
user.university.organizations.ordered,
I18n.t(
'filters.attributes.element',
element: University::Organization.model_name.human.downcase
)
add :for_alumni_program,
user.university.education_programs,
I18n.t(
......@@ -17,6 +22,7 @@ module Filters
'filters.attributes.element',
element: Education::AcademicYear.model_name.human.downcase
)
add_search
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment