Skip to content
Snippets Groups Projects
Unverified Commit 7fbf0c3a authored by Sébastien Gaya's avatar Sébastien Gaya Committed by GitHub
Browse files

fix program administrators & teachers (#2250)

parent 3c411795
No related branches found
No related tags found
No related merge requests found
......@@ -124,20 +124,6 @@ class Education::Program < ApplicationRecord
# WebsitesLinkable methods
#####################
def has_administrators?
university_people_through_role_involvements.any? ||
descendants.any? { |descendant| descendant.university_people_through_role_involvements.any? }
end
def has_researchers?
false
end
def has_teachers?
university_people_through_involvements.any? ||
descendants.any? { |descendant| descendant.university_people_through_involvements.any? }
end
def has_education_programs?
true
end
......
......@@ -29,4 +29,34 @@ module Education::Program::WithTeam
through: :university_person_involvements,
source: :person
end
def administrators
people_ids = (
university_people_through_role_involvements +
descendants.collect(&:university_people_through_role_involvements).flatten
).pluck(:id)
university.people.where(id: people_ids, is_administration: true)
end
def teachers
people_ids = (
university_people_through_involvements +
descendants.collect(&:university_people_through_involvements).flatten
).pluck(:id)
university.people.where(id: people_ids, is_teacher: true)
end
def has_administrators?
university_people_through_role_involvements.any? ||
descendants.any? { |descendant| descendant.university_people_through_role_involvements.any? }
end
def has_researchers?
false
end
def has_teachers?
university_people_through_involvements.any? ||
descendants.any? { |descendant| descendant.university_people_through_involvements.any? }
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