SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
SciPost
SciPost
Commits
c3d52257
Commit
c3d52257
authored
4 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Improve display in case pubfractions are zero
parent
ed30e1f7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
organizations/models.py
+8
-11
8 additions, 11 deletions
organizations/models.py
with
8 additions
and
11 deletions
organizations/models.py
+
8
−
11
View file @
c3d52257
...
@@ -127,25 +127,22 @@ class Organization(models.Model):
...
@@ -127,25 +127,22 @@ class Organization(models.Model):
def
pubfraction_for_publication
(
self
,
doi_label
):
def
pubfraction_for_publication
(
self
,
doi_label
):
"""
"""
Return the organization
'
s pubfraction for
this
publication
, or the string
'
Not defined
'
.
Return the organization
'
s pubfraction for
a
publication.
"""
"""
pfs
=
OrgPubFraction
.
objects
.
filter
(
publication__doi_label
=
doi_label
)
pfs
=
OrgPubFraction
.
objects
.
filter
(
publication__doi_label
=
doi_label
)
try
:
try
:
return
pfs
.
get
(
organization
=
self
).
fraction
return
pfs
.
get
(
organization
=
self
).
fraction
except
OrgPubFraction
.
DoesNotExist
:
except
OrgPubFraction
.
DoesNotExist
:
# check if any children have a nonzero contribution
children_ids
=
[
k
[
'
id
'
]
for
k
in
list
(
self
.
children
.
all
().
values
(
'
id
'
))]
children_ids
=
[
k
[
'
id
'
]
for
k
in
list
(
self
.
children
.
all
().
values
(
'
id
'
))]
children_contribs
=
pfs
.
filter
(
organization__id__in
=
children_ids
).
aggregate
(
children_contribs
=
pfs
.
filter
(
organization__id__in
=
children_ids
).
aggregate
(
Sum
(
'
fraction
'
))[
'
fraction__sum
'
]
Sum
(
'
fraction
'
))[
'
fraction__sum
'
]
if
children_contribs
:
if
children_contribs
is
not
None
:
if
children_contribs
>
0
:
message
=
"
as parent (ascribed to
"
message
=
"
as parent (ascribed to
"
for
child
in
self
.
children
.
all
():
for
child
in
self
.
children
.
all
():
pfc
=
child
.
pubfraction_for_publication
(
doi_label
)
pfc
=
child
.
pubfraction_for_publication
(
doi_label
)
if
pfc
not
in
[
'
No PubFraction ascribed
'
,
'
Not yet defined
'
]:
if
pfc
not
in
[
'
No PubFraction ascribed
'
,
'
Not yet defined
'
]:
message
+=
"
%s: %s;
"
%
(
child
,
pfc
)
message
+=
"
%s: %s;
"
%
(
child
,
pfc
)
return
message
.
rpartition
(
'
;
'
)[
0
]
+
'
)
'
return
message
.
rpartition
(
'
;
'
)[
0
]
+
'
)
'
return
'
No PubFraction ascribed
'
return
'
Not yet defined
'
return
'
Not yet defined
'
def
pubfractions_in_year
(
self
,
year
):
def
pubfractions_in_year
(
self
,
year
):
...
...
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