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
c18d122a
Commit
c18d122a
authored
3 years ago
by
pabois
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
6eadbc1f
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/university/person.rb
+9
-9
9 additions, 9 deletions
app/models/university/person.rb
with
9 additions
and
9 deletions
app/models/university/person.rb
+
9
−
9
View file @
c18d122a
...
...
@@ -55,17 +55,17 @@ class University::Person < ApplicationRecord
foreign_key: :author_id
,
dependent: :nullify
has_many
:
communication
_websites
,
has_many
:
author
_websites
,
->
{
distinct
},
through: :communication_website_posts
,
source: :website
has_many
:research_websites
,
has_many
:research
er
_websites
,
->
{
distinct
},
through: :research_journal_articles
,
source: :websites
has_many
:
education
_websites
,
has_many
:
teacher
_websites
,
->
{
distinct
},
through: :education_programs
,
source: :websites
...
...
@@ -93,19 +93,19 @@ class University::Person < ApplicationRecord
def
websites
Communication
::
Website
.
where
(
id:
[
communication
_website_ids
,
research_website_ids
,
education
_website_ids
author
_website_ids
,
research
er
_website_ids
,
teacher
_website_ids
].
flatten
.
uniq
)
end
def
identifiers
(
website:
nil
)
website_id
=
website
&
.
id
list
=
[]
list
<<
:author
if
communication_websites
.
pluck
(
:id
).
include?
(
website_id
)
list
<<
:researcher
if
research_websites
.
pluck
(
:id
).
include?
(
website_id
)
list
<<
:teacher
if
education_websites
.
pluck
(
:id
).
include?
(
website_id
)
# TODO :administrator
[
:author
,
:researcher
,
:teacher
].
each
do
|
role
|
list
<<
role
if
send
(
"
#{
role
.
to_s
}
_websites"
).
pluck
(
:id
).
include?
(
website_id
)
end
list
<<
:static
unless
list
.
empty?
list
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