diff --git a/scipost_django/submissions/forms.py b/scipost_django/submissions/forms.py index 298b2fb8cce48d60d15c9a54eaaf1a47dd7ebe28..6ab1920f66c382844c0996988f37e26af77bc626 100644 --- a/scipost_django/submissions/forms.py +++ b/scipost_django/submissions/forms.py @@ -1652,6 +1652,8 @@ class SetRefereeingDeadlineForm(forms.Form): def clean_deadline(self): if not self.cleaned_data.get('deadline'): self.add_error('deadline', 'Please use a valid date.') + if not (self.cleaned_data.get('deadline') >= timezone.now().date()): + self.add_error('deadline', 'Please choose a future date!') return self.cleaned_data.get('deadline') diff --git a/scipost_django/submissions/models/submission.py b/scipost_django/submissions/models/submission.py index 0cb9ac61cb90ecd233368ea0dcbe244f20c33710..429dd0fa12fd757d01b1dad63a05832529acaed3 100644 --- a/scipost_django/submissions/models/submission.py +++ b/scipost_django/submissions/models/submission.py @@ -278,7 +278,7 @@ class Submission(models.Model): return timezone.now() > self.reporting_deadline - datetime.timedelta(days=7) @property - def is_open_for_reporting(self): + def is_open_for_reporting_within_deadline(self): """Check if Submission is open for reporting and within deadlines.""" return self.open_for_reporting and not self.reporting_deadline_has_passed @@ -320,7 +320,7 @@ class Submission(models.Model): return True # Maybe: Check for unvetted Reports? - return self.status == STATUS_EIC_ASSIGNED and self.is_open_for_reporting + return self.status == STATUS_EIC_ASSIGNED and self.is_open_for_reporting_within_deadline @property def can_reset_reporting_deadline(self): diff --git a/scipost_django/submissions/templates/submissions/_submission_quick_actions.html b/scipost_django/submissions/templates/submissions/_submission_quick_actions.html index 25910c74809427010a926568c5449e49d610bcbf..de0e4616b877e92920bf89eb288b10a76536c593 100644 --- a/scipost_django/submissions/templates/submissions/_submission_quick_actions.html +++ b/scipost_django/submissions/templates/submissions/_submission_quick_actions.html @@ -2,7 +2,10 @@ <div class="submission-quick-actions"> <h3>Actions</h3> <ul class="my-2 ps-4"> - {% if submission.is_open_for_reporting and perms.scipost.can_referee %} + {% if unfinished_report_for_user %} + <li>{% include 'bi/exclamation-circle-fill.html' %} You have an unfinished report for this submission. You can <a href="{% url 'submissions:submit_report' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">finish your report here</a>.</li> + {% endif %} + {% if submission.open_for_reporting and perms.scipost.can_referee %} <li> <h4> {% if not is_author and not is_author_unchecked %} @@ -44,8 +47,6 @@ </div> </li> {% endif %} - {% elif unfinished_report_for_user %} - <li>{% include 'bi/exclamation-circle-fill.html' %} You have an unfinished report for this submission. You can <a href="{% url 'submissions:submit_report' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">finish your report here</a>.</li> {% else %} <li class="py-1">Reporting for this Submission is closed.</li> {% endif %} diff --git a/scipost_django/submissions/templates/submissions/pool/editorial_page.html b/scipost_django/submissions/templates/submissions/pool/editorial_page.html index b1e3e732151fa7b2b8f0fdf67ddc3d6fe0fb4538..e82fc435154790fc4acb16699f61299c4e4454dc 100644 --- a/scipost_django/submissions/templates/submissions/pool/editorial_page.html +++ b/scipost_django/submissions/templates/submissions/pool/editorial_page.html @@ -196,7 +196,7 @@ <tr id="reporting-deadline"> <td>Open for refereeing:</td> <td> - {% if submission.is_open_for_reporting %} + {% if submission.is_open_for_reporting_within_deadline %} <span class="text-success" aria-hidden="true">{% include 'bi/check-circle-fill.html' %}</span> <span class="text-muted">Open for refereeing. Deadline: {{ submission.reporting_deadline|date:"SHORT_DATE_FORMAT" }}.</span> {% else %} @@ -224,7 +224,7 @@ {% endif %} {% if submission.can_reset_reporting_deadline %} - {% if submission.is_open_for_reporting %} + {% if submission.is_open_for_reporting_within_deadline %} <div class="my-1"> You may extend the refereeing deadline by <a href="{% url 'submissions:extend_refereeing_deadline' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr days=2 %}">2 days</a>, @@ -354,7 +354,7 @@ </li> {% endif %} - {% if submission.is_open_for_reporting %} + {% if submission.is_open_for_reporting_within_deadline %} <li><a href="{% url 'submissions:close_refereeing_round' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">Close the refereeing round</a> (deactivates submission of new Reports and Comments)</li> {% endif %} {% endif %} diff --git a/scipost_django/submissions/views.py b/scipost_django/submissions/views.py index 81c8370f216fc1cbcad4c8f0cc107982b9bb0746..733e104d7fc9f1b12af250d28105e33deacf56a9 100644 --- a/scipost_django/submissions/views.py +++ b/scipost_django/submissions/views.py @@ -1121,7 +1121,7 @@ def select_referee(request, identifier_w_vn_nr): submission = get_object_or_404(Submission.objects.filter_for_eic(request.user), preprint__identifier_w_vn_nr=identifier_w_vn_nr) - if not submission.is_open_for_reporting: + if not submission.is_open_for_reporting_within_deadline: txt = ( 'The refereeing deadline has passed. You cannot invite a referee anymore.' ' Please, first extend the deadline of the refereeing to invite a referee.') @@ -1482,12 +1482,12 @@ def set_refereeing_deadline(request, identifier_w_vn_nr): if form.is_valid(): Submission.objects.filter(pk=submission.id).update( reporting_deadline=form.cleaned_data['deadline'], - open_for_reporting=(form.cleaned_data['deadline'] >= timezone.now().date()), + open_for_reporting=True, latest_activity = timezone.now()) submission.add_general_event('A new refereeing deadline is set.') - messages.success(request, 'New reporting deadline set.') + messages.success(request, 'New reporting deadline set to %s.' % submission.reporting_deadline.date()) else: - messages.error(request, 'The deadline has not been set. Please try again.') + messages.error(request, 'The deadline has not been set: %s Please try again.' % form.errors) return redirect(reverse('submissions:editorial_page', kwargs={'identifier_w_vn_nr': identifier_w_vn_nr})) @@ -1720,10 +1720,11 @@ def submit_report(request, identifier_w_vn_nr): ' to clarify this.') elif not invitation: # User is going to contribute a Report. Check deadlines for doing so. - if timezone.now() > submission.reporting_deadline + datetime.timedelta(days=1): - errormessage = ('The reporting deadline has passed. You cannot submit' - ' a Report anymore.') - elif not submission.open_for_reporting: + # Allow post-deadline reporting: + # if timezone.now() > submission.reporting_deadline + datetime.timedelta(days=1): + # errormessage = ('The reporting deadline has passed. You cannot submit' + # ' a Report anymore.') + if not submission.open_for_reporting: errormessage = ('Reporting for this submission has closed. You cannot submit' ' a Report anymore.')