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
4febaeca
Unverified
Commit
4febaeca
authored
3 years ago
by
Sébastien Gaya
Browse files
Options
Downloads
Patches
Plain Diff
published in research
parent
25c04eb5
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/communication/website/with_dependencies.rb
+2
-2
2 additions, 2 deletions
app/models/communication/website/with_dependencies.rb
app/models/research/journal.rb
+12
-6
12 additions, 6 deletions
app/models/research/journal.rb
with
14 additions
and
8 deletions
app/models/communication/website/with_dependencies.rb
+
2
−
2
View file @
4febaeca
...
...
@@ -34,11 +34,11 @@ module Communication::Website::WithDependencies
end
def
research_volumes
has_research_volumes?
?
about
.
volumes
:
Research
::
Journal
::
Volume
.
none
has_research_volumes?
?
about
.
published_
volumes
:
Research
::
Journal
::
Volume
.
none
end
def
research_articles
has_research_articles?
?
about
.
articles
:
Research
::
Journal
::
Article
.
none
has_research_articles?
?
about
.
published_
articles
:
Research
::
Journal
::
Article
.
none
end
def
administrators
...
...
This diff is collapsed.
Click to expand it.
app/models/research/journal.rb
+
12
−
6
View file @
4febaeca
...
...
@@ -27,9 +27,11 @@ class Research::Journal < ApplicationRecord
has_many
:websites
,
class_name:
'Communication::Website'
,
as: :about
,
dependent: :nullify
has_many
:volumes
,
foreign_key: :research_journal_id
,
dependent: :destroy
has_many
:published_volumes
,
->
{
published
},
foreign_key: :research_journal_id
,
dependent: :destroy
has_many
:articles
,
foreign_key: :research_journal_id
,
dependent: :destroy
has_many
:published_articles
,
->
{
published
},
foreign_key: :research_journal_id
,
dependent: :destroy
has_many
:people
,
->
{
distinct
},
through: :articles
alias
researchers
people
has_many
:people_through_published_articles
,
->
{
distinct
},
through: :published_articles
scope
:ordered
,
->
{
order
(
:title
)
}
...
...
@@ -37,15 +39,19 @@ class Research::Journal < ApplicationRecord
"
#{
title
}
"
end
def
researchers
university
.
people
.
where
(
id:
people_through_published_articles
.
pluck
(
:id
),
is_researcher:
true
)
end
def
git_path
(
website
)
"data/journal.yml"
end
def
git_dependencies
(
website
)
dependencies
=
[
self
]
dependencies
+=
articles
+
articles
.
map
(
&
:active_storage_blobs
).
flatten
if
has_research_articles?
dependencies
+=
volumes
+
volumes
.
map
(
&
:active_storage_blobs
).
flatten
if
has_research_volumes?
dependencies
+=
people
+
people
.
map
(
&
:researcher
)
+
people
.
map
(
&
:active_storage_blobs
).
flatten
if
has_researchers?
dependencies
+=
published_
articles
+
published_
articles
.
map
(
&
:active_storage_blobs
).
flatten
if
has_research_articles?
dependencies
+=
published_volumes
+
published_
volumes
.
map
(
&
:active_storage_blobs
).
flatten
if
has_research_volumes?
dependencies
+=
researchers
+
researchers
.
map
(
&
:researcher
)
+
researchers
.
map
(
&
:active_storage_blobs
).
flatten
if
has_researchers?
dependencies
end
...
...
@@ -70,10 +76,10 @@ class Research::Journal < ApplicationRecord
end
def
has_research_articles?
articles
.
any?
published_articles
.
published
.
any?
end
def
has_research_volumes?
volumes
.
any?
published_volumes
.
published
.
any?
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