Skip to content
Snippets Groups Projects
Commit 7e667132 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

wip

parent 3c25ddc2
No related branches found
No related tags found
No related merge requests found
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
# #
class Administration::Location < ApplicationRecord class Administration::Location < ApplicationRecord
include AsIndirectObject include AsIndirectObject
include Sanitizable
include Contentful include Contentful
include Sanitizable
include Sluggable include Sluggable
include WebsitesLinkable include WebsitesLinkable
include WithBlobs include WithBlobs
...@@ -43,11 +43,18 @@ class Administration::Location < ApplicationRecord ...@@ -43,11 +43,18 @@ class Administration::Location < ApplicationRecord
class_name: 'Education::School', class_name: 'Education::School',
foreign_key: :education_school_id, foreign_key: :education_school_id,
association_foreign_key: :administration_location_id association_foreign_key: :administration_location_id
alias_method :education_schools, :schools
has_and_belongs_to_many :programs, has_and_belongs_to_many :programs,
class_name: 'Education::Program', class_name: 'Education::Program',
foreign_key: :education_program_id, foreign_key: :education_program_id,
association_foreign_key: :administration_location_id association_foreign_key: :administration_location_id
alias_method :education_programs, :programs
has_many :diplomas,
-> { distinct },
through: :programs,
source: :diploma
alias_method :education_diplomas, :diplomas
scope :ordered, -> { order(:name) } scope :ordered, -> { order(:name) }
...@@ -72,8 +79,41 @@ class Administration::Location < ApplicationRecord ...@@ -72,8 +79,41 @@ class Administration::Location < ApplicationRecord
[] []
end end
# Un site n'a pas de site dépendant # WebsitesLinkable
def has_administrators?
# TODO les administrateurs du site
false
end
def has_researchers?
# TODO les chercheurs du site
false
end
def has_teachers?
# TODO les enseignants du site
false
end
def has_education_programs?
programs.any?
end
def has_education_diplomas?
diplomas.any?
end
def has_research_papers?
false
end
def has_research_volumes?
false
end
def has_administration_locations? def has_administration_locations?
# Un site (location) n'a pas de site (location) dépendant
false false
end 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