Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
7e667132
Commit
7e667132
authored
1 year ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
3c25ddc2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/administration/location.rb
+43
-3
43 additions, 3 deletions
app/models/administration/location.rb
with
43 additions
and
3 deletions
app/models/administration/location.rb
+
43
−
3
View file @
7e667132
...
...
@@ -28,8 +28,8 @@
#
class
Administration::Location
<
ApplicationRecord
include
AsIndirectObject
include
Sanitizable
include
Contentful
include
Sanitizable
include
Sluggable
include
WebsitesLinkable
include
WithBlobs
...
...
@@ -43,11 +43,18 @@ class Administration::Location < ApplicationRecord
class_name:
'Education::School'
,
foreign_key: :education_school_id
,
association_foreign_key: :administration_location_id
alias_method
:education_schools
,
:schools
has_and_belongs_to_many
:programs
,
class_name:
'Education::Program'
,
foreign_key: :education_program_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
)
}
...
...
@@ -72,8 +79,41 @@ class Administration::Location < ApplicationRecord
[]
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?
# Un site (location) n'a pas de site (location) dépendant
false
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment