From aeee3c702ca7a83da27412d592023abe3e2b4539 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Mon, 2 Sep 2024 12:24:32 +0200
Subject: [PATCH] reset the ref cycle to default if first submission

---
 scipost_django/submissions/models/submission.py             | 6 ++++--
 .../templates/submissions/pool/editorial_page.html          | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/scipost_django/submissions/models/submission.py b/scipost_django/submissions/models/submission.py
index c49a83a94..ea53938c7 100644
--- a/scipost_django/submissions/models/submission.py
+++ b/scipost_django/submissions/models/submission.py
@@ -641,12 +641,14 @@ class Submission(models.Model):
     def reset_refereeing_cycle(self):
         """
         Reset the submission's refereeing cycle:
-        - Set the refereeing cycle to the undetermined state
+        - Set the refereeing cycle to the undetermined state if it a resubmission, otherwise to the default cycle
         - Set the submission status to refereeing in preparation
         """
         self._cycle = None
         self.status = self.REFEREEING_IN_PREPARATION
-        self.refereeing_cycle = CYCLE_UNDETERMINED
+        self.refereeing_cycle = (
+            CYCLE_UNDETERMINED if self.is_resubmission else CYCLE_DEFAULT
+        )
         self.save()
 
     def get_absolute_url(self):
diff --git a/scipost_django/submissions/templates/submissions/pool/editorial_page.html b/scipost_django/submissions/templates/submissions/pool/editorial_page.html
index c8fa179db..e786939d0 100644
--- a/scipost_django/submissions/templates/submissions/pool/editorial_page.html
+++ b/scipost_django/submissions/templates/submissions/pool/editorial_page.html
@@ -150,8 +150,8 @@ container border border-warning border-3
     <tr>
       <td>Refereeing cycle:</td>
       <td><span class="p-1 label label-secondary me-3">{{ submission.get_refereeing_cycle_display }}</span>
-        {% if full_access and submission.refereeing_cycle and submission.is_resubmission and not submission.referee_invitations.all and not submission.recommendation %}
-            Was this a mistake? If so, you may <a href="{% url 'submissions:reset_refereeing_cycle' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">reset the refereeing cycle</a>.
+        {% if full_access and submission.refereeing_cycle and not submission.referee_invitations.all and not submission.recommendation %}
+            Was this a mistake? If so, you may <a href="{% url 'submissions:reset_refereeing_cycle' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">reset the refereeing cycle {% if submission.is_resubmission %}to default{% endif %}</a>.
         {% endif %}
       </td>
     </tr>
-- 
GitLab