From 362a4a561537cae310221d2c6da34ae634df00ae Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Thu, 24 May 2018 10:06:54 +0200 Subject: [PATCH] Fix resubmission logic --- .../partials/scipost/personal_page/submissions.html | 2 +- submissions/forms.py | 8 +------- submissions/models.py | 9 +++++++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/scipost/templates/partials/scipost/personal_page/submissions.html b/scipost/templates/partials/scipost/personal_page/submissions.html index 55b261d02..d5609ab54 100644 --- a/scipost/templates/partials/scipost/personal_page/submissions.html +++ b/scipost/templates/partials/scipost/personal_page/submissions.html @@ -32,7 +32,7 @@ {% if sub.editor_in_charge %} <a href="{% url 'submissions:communication' sub.arxiv_identifier_w_vn_nr 'AtoE' %}">Write to the Editor-in-charge</a> {% endif %} - {% if sub.revision_requested %} + {% if sub.open_for_resubmission %} · <a href="{% url 'submissions:prefill_using_identifier' %}?identifier={{ sub.arxiv_identifier_wo_vn_nr }}">Resubmit this manuscript</a> {% endif %} </p> diff --git a/submissions/forms.py b/submissions/forms.py index 331c69dd1..ce3532d94 100644 --- a/submissions/forms.py +++ b/submissions/forms.py @@ -144,7 +144,7 @@ class SubmissionChecks: # If submissions are found; check their statuses if submission: self.last_submission = submission - if submission.revision_requested: + if submission.open_for_resubmission: self.is_resubmission = True if self.requested_by.contributor not in submission.authors.all(): error_message = ('There exists a preprint with this arXiv identifier ' @@ -782,12 +782,6 @@ class ReportForm(forms.ModelForm): # An active EICRecommendation is already formulated. This Report will be flagged. self.report_type = REPORT_POST_EDREC - # def clean_file_attachment(self): - # f = self.cleaned_data['file_attachment'] - # r = f.file - # raise - # return f - def save(self): """ Update meta data if ModelForm is submitted (non-draft). diff --git a/submissions/models.py b/submissions/models.py index 808f95b7c..3211a217d 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -17,7 +17,7 @@ from .behaviors import SubmissionRelatedObjectMixin from .constants import ( ASSIGNMENT_REFUSAL_REASONS, ASSIGNMENT_NULLBOOL, SUBMISSION_TYPE, ED_COMM_CHOICES, REFEREE_QUALIFICATION, QUALITY_SPEC, RANKING_CHOICES, REPORT_REC, - SUBMISSION_STATUS, REPORT_STATUSES, STATUS_UNVETTED, STATUS_INCOMING, + SUBMISSION_STATUS, REPORT_STATUSES, STATUS_UNVETTED, STATUS_INCOMING, STATUS_EIC_ASSIGNED, SUBMISSION_CYCLES, CYCLE_DEFAULT, CYCLE_SHORT, STATUS_RESUBMITTED, DECISION_FIXED, CYCLE_DIRECT_REC, EVENT_GENERAL, EVENT_TYPES, EVENT_FOR_AUTHOR, EVENT_FOR_EIC, REPORT_TYPES, REPORT_NORMAL, STATUS_DRAFT, STATUS_VETTED, EIC_REC_STATUSES, VOTING_IN_PREP, @@ -202,7 +202,12 @@ class Submission(models.Model): @property def revision_requested(self): """Check if Submission has fixed EICRecommendation asking for revision.""" - if self.status != STATUS_RESUBMITTED: + return self.eicrecommendations.fixed().asking_revision().exists() + + @property + def open_for_resubmission(self): + """Check if Submission has fixed EICRecommendation asking for revision.""" + if self.status != STATUS_EIC_ASSIGNED: return False return self.eicrecommendations.fixed().asking_revision().exists() -- GitLab