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
2780dd82
Commit
2780dd82
authored
6 years ago
by
Jorran de Wit
Browse files
Options
Downloads
Patches
Plain Diff
Fix ArXiv query
parent
612d4287
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
submissions/views.py
+20
-16
20 additions, 16 deletions
submissions/views.py
with
20 additions
and
16 deletions
submissions/views.py
+
20
−
16
View file @
2780dd82
...
...
@@ -1392,8 +1392,7 @@ def prepare_for_voting(request, rec_id):
fellows_with_expertise
=
recommendation
.
submission
.
fellows
.
filter
(
contributor__expertises__contains
=
[
recommendation
.
submission
.
subject_area
])
coauthorships
=
{}
coauthorships
=
[]
eligibility_form
=
VotingEligibilityForm
(
request
.
POST
or
None
,
instance
=
recommendation
)
if
eligibility_form
.
is_valid
():
eligibility_form
.
save
()
...
...
@@ -1408,21 +1407,26 @@ def prepare_for_voting(request, rec_id):
else
:
# Identify possible co-authorships in last 3 years, disqualifying Fellow from voting:
if
recommendation
.
submission
.
metadata
is
not
None
:
author_last_names
=
[]
for
author
in
recommendation
.
submission
.
metadata
[
'
entries
'
][
0
][
'
authors
'
]:
# Gather author data to do conflict-of-interest queries with
author_last_names
.
append
(
author
[
'
name
'
].
split
()[
-
1
])
fellow_last_names
=
[]
for
fellow
in
fellows_with_expertise
:
sub_auth_boolean_str
=
'
((
'
+
(
recommendation
.
submission
.
metadata
[
'
entries
'
][
0
][
'
authors
'
][
0
][
'
name
'
]
.
split
()[
-
1
])
for
author
in
recommendation
.
submission
.
metadata
[
'
entries
'
][
0
][
'
authors
'
][
1
:]:
sub_auth_boolean_str
+=
'
+OR+
'
+
author
[
'
name
'
].
split
()[
-
1
]
sub_auth_boolean_str
+=
'
)+AND+
'
search_str
=
sub_auth_boolean_str
+
fellow
.
contributor
.
user
.
last_name
+
'
)
'
queryurl
=
(
'
http://export.arxiv.org/api/query?search_query=au:%s
'
%
search_str
+
'
&sortBy=submittedDate&sortOrder=descending
'
'
&max_results=5
'
)
arxivquery
=
feedparser
.
parse
(
queryurl
)
queryresults
=
arxivquery
if
queryresults
.
entries
:
coauthorships
[
fellow
.
contributor
.
user
.
last_name
]
=
queryresults
# For each fellow found, so a query with the authors to check for conflicts
fellow_last_names
.
append
(
fellow
.
contributor
.
user
.
last_name
)
search_query
=
'
au:(({fellows})+AND+({authors}))
'
.
format
(
fellows
=
'
+OR+
'
.
join
(
fellow_last_names
),
authors
=
'
+OR+
'
.
join
(
author_last_names
))
queryurl
=
'
https://export.arxiv.org/api/query?search_query={sq}
'
.
format
(
sq
=
search_query
)
queryurl
+=
'
&sortBy=submittedDate&sortOrder=descending&max_results=5
'
queryurl
=
queryurl
.
replace
(
'
'
,
'
+
'
)
# Fallback for some last names with spaces
queryresults
=
feedparser
.
parse
(
queryurl
)
if
queryresults
.
entries
:
coauthorships
=
queryresults
context
=
{
'
recommendation
'
:
recommendation
,
...
...
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