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
40ed04cf
Commit
40ed04cf
authored
7 years ago
by
Jorran de Wit
Browse files
Options
Downloads
Plain Diff
Merge branch 'tests' into development
parents
bc5cf354
3fab0622
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
submissions/factories.py
+1
-1
1 addition, 1 deletion
submissions/factories.py
submissions/managers.py
+18
-1
18 additions, 1 deletion
submissions/managers.py
submissions/test_views.py
+11
-0
11 additions, 0 deletions
submissions/test_views.py
with
30 additions
and
2 deletions
submissions/factories.py
+
1
−
1
View file @
40ed04cf
...
@@ -38,7 +38,7 @@ class SubmissionFactory(factory.django.DjangoModelFactory):
...
@@ -38,7 +38,7 @@ class SubmissionFactory(factory.django.DjangoModelFactory):
'''
Fill empty arxiv fields.
'''
'''
Fill empty arxiv fields.
'''
self
.
arxiv_link
=
'
https://arxiv.org/abs/%s
'
%
self
.
arxiv_identifier_wo_vn_nr
self
.
arxiv_link
=
'
https://arxiv.org/abs/%s
'
%
self
.
arxiv_identifier_wo_vn_nr
self
.
arxiv_identifier_w_vn_nr
=
'
%sv1
'
%
self
.
arxiv_identifier_wo_vn_nr
self
.
arxiv_identifier_w_vn_nr
=
'
%sv1
'
%
self
.
arxiv_identifier_wo_vn_nr
self
.
arxiv_vn_nr
=
1
self
.
arxiv_vn_nr
=
kwargs
.
get
(
'
arxiv_vn_nr
'
,
1
)
@factory.post_generation
@factory.post_generation
def
contributors
(
self
,
create
,
extracted
,
**
kwargs
):
def
contributors
(
self
,
create
,
extracted
,
**
kwargs
):
...
...
This diff is collapsed.
Click to expand it.
submissions/managers.py
+
18
−
1
View file @
40ed04cf
...
@@ -8,6 +8,22 @@ from .constants import SUBMISSION_STATUS_OUT_OF_POOL, SUBMISSION_STATUS_PUBLICLY
...
@@ -8,6 +8,22 @@ from .constants import SUBMISSION_STATUS_OUT_OF_POOL, SUBMISSION_STATUS_PUBLICLY
class
SubmissionManager
(
models
.
Manager
):
class
SubmissionManager
(
models
.
Manager
):
def
_newest_version_only
(
self
,
queryset
):
"""
The current Queryset should return only the latest version
of the Arxiv submissions known to SciPost.
Method only compatible with PostGresQL
"""
# This method used a double query, which is a consequence of the complex distinct()
# filter combined with the PostGresQL engine. Without the double query, ordering
# on a specific field after filtering would be impossible.
ids
=
(
queryset
.
order_by
(
'
arxiv_identifier_wo_vn_nr
'
,
'
-arxiv_vn_nr
'
)
.
distinct
(
'
arxiv_identifier_wo_vn_nr
'
)
.
values_list
(
'
id
'
,
flat
=
True
))
return
queryset
.
filter
(
id__in
=
ids
)
def
user_filter
(
self
,
user
):
def
user_filter
(
self
,
user
):
"""
"""
Prevent conflic of interest by filtering submissions possible related to user.
Prevent conflic of interest by filtering submissions possible related to user.
...
@@ -54,7 +70,8 @@ class SubmissionManager(models.Manager):
...
@@ -54,7 +70,8 @@ class SubmissionManager(models.Manager):
This query contains an overcomplete set of public submissions, i.e. also containing
This query contains an overcomplete set of public submissions, i.e. also containing
submissions with status
"
published
"
or
"
resubmitted
"
.
submissions with status
"
published
"
or
"
resubmitted
"
.
"""
"""
return
self
.
exclude
(
status__in
=
SUBMISSION_STATUS_PUBLICLY_INVISIBLE
)
queryset
=
self
.
exclude
(
status__in
=
SUBMISSION_STATUS_PUBLICLY_INVISIBLE
)
return
self
.
_newest_version_only
(
queryset
)
class
EditorialAssignmentManager
(
models
.
Manager
):
class
EditorialAssignmentManager
(
models
.
Manager
):
...
...
This diff is collapsed.
Click to expand it.
submissions/test_views.py
+
11
−
0
View file @
40ed04cf
...
@@ -223,6 +223,17 @@ class SubmissionListTest(BaseContributorTestCase):
...
@@ -223,6 +223,17 @@ class SubmissionListTest(BaseContributorTestCase):
visible_submission_ids
.
append
(
EICassignedSubmissionFactory
.
create
().
id
)
visible_submission_ids
.
append
(
EICassignedSubmissionFactory
.
create
().
id
)
visible_submission_ids
.
append
(
PublishedSubmissionFactory
.
create
().
id
)
visible_submission_ids
.
append
(
PublishedSubmissionFactory
.
create
().
id
)
# Extra submission with multiple versions where the newest is publicly visible
# again. Earlier versions should therefore be invisible!
arxiv_id_resubmission
=
random_arxiv_identifier_without_version_number
()
ResubmittedSubmissionFactory
.
create
(
arxiv_identifier_wo_vn_nr
=
arxiv_id_resubmission
)
visible_submission_ids
.
append
(
EICassignedSubmissionFactory
.
create
(
arxiv_identifier_wo_vn_nr
=
arxiv_id_resubmission
,
fill_arxiv_fields__arxiv_vn_nr
=
2
).
id
)
# Check with hardcoded URL as this url shouldn't change!
# Check with hardcoded URL as this url shouldn't change!
client
=
Client
()
client
=
Client
()
response
=
client
.
get
(
'
/submissions/
'
)
response
=
client
.
get
(
'
/submissions/
'
)
...
...
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