Skip to content
Snippets Groups Projects
Unverified Commit 1d13b213 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

Aboutable + Education::School iomplements Aboutable

parent 0937f101
No related branches found
No related tags found
No related merge requests found
module Aboutable
extend ActiveSupport::Concern
def has_administrators?
raise NotImplementedError
end
def has_researchers?
raise NotImplementedError
end
def has_teachers?
raise NotImplementedError
end
def has_education_programs?
raise NotImplementedError
end
def has_research_articles?
raise NotImplementedError
end
def has_research_volumes?
raise NotImplementedError
end
end
......@@ -25,6 +25,7 @@
#
class Education::School < ApplicationRecord
include WithGit
include Aboutable
has_and_belongs_to_many :programs,
class_name: 'Education::Program',
......@@ -61,6 +62,15 @@ class Education::School < ApplicationRecord
"#{name}"
end
def researchers
people_ids = (
university_people_through_program_involvements +
university_people_through_role_involvements +
university_people_through_program_role_involvements
).pluck(:id)
university.people.where(id: people_ids, is_researcher: true)
end
def git_path(website)
"data/school.yml"
end
......@@ -71,4 +81,29 @@ class Education::School < ApplicationRecord
university_people_through_role_involvements.map(&:administrator) +
university_people_through_role_involvements.map(&:active_storage_blobs).flatten
end
def has_administrators?
university_people_through_role_involvements.any? ||
university_people_through_program_role_involvements.any?
end
def has_researchers?
researchers.any?
end
def has_teachers?
university_people_through_program_involvements.any?
end
def has_education_programs?
programs.any?
end
def has_research_articles?
false
end
def has_research_volumes?
false
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