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
1d13b213
Unverified
Commit
1d13b213
authored
3 years ago
by
Sébastien Gaya
Browse files
Options
Downloads
Patches
Plain Diff
Aboutable + Education::School iomplements Aboutable
parent
0937f101
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/concerns/aboutable.rb
+27
-0
27 additions, 0 deletions
app/models/concerns/aboutable.rb
app/models/education/school.rb
+35
-0
35 additions, 0 deletions
app/models/education/school.rb
with
62 additions
and
0 deletions
app/models/concerns/aboutable.rb
0 → 100644
+
27
−
0
View file @
1d13b213
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
This diff is collapsed.
Click to expand it.
app/models/education/school.rb
+
35
−
0
View file @
1d13b213
...
...
@@ -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
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