From b455db79c3b59175ec5f68167b87b7a6dd39adf3 Mon Sep 17 00:00:00 2001 From: George Katsikas <giorgakis.katsikas@gmail.com> Date: Fri, 25 Oct 2024 14:08:35 +0200 Subject: [PATCH] increase default assignment deadline to 2 months reword assignment stage update email disable automatic withdrawal after assignment deadline --- .../common/templatetags/common_extras.py | 4 ++ .../0139_alter_journal_assignment_period.py | 18 +++++++++ scipost_django/journals/models/journal.py | 2 +- .../personal_page/_hx_submissions.html | 7 ++-- .../commands/send_assignment_stage_update.py | 37 ++++++++++++------- .../submissions/models/submission.py | 11 +++--- scipost_django/submissions/views/__init__.py | 3 +- .../update_authors_assignment_stage.html | 22 +++++------ 8 files changed, 68 insertions(+), 36 deletions(-) create mode 100644 scipost_django/journals/migrations/0139_alter_journal_assignment_period.py diff --git a/scipost_django/common/templatetags/common_extras.py b/scipost_django/common/templatetags/common_extras.py index f3b539fe8..2cbe2078d 100644 --- a/scipost_django/common/templatetags/common_extras.py +++ b/scipost_django/common/templatetags/common_extras.py @@ -41,6 +41,10 @@ def equal(a, b): # Math @register.filter def int_divide(a, b): + if b == 0: + return 0 + if isinstance(a, str): + a = int(a) return a // b diff --git a/scipost_django/journals/migrations/0139_alter_journal_assignment_period.py b/scipost_django/journals/migrations/0139_alter_journal_assignment_period.py new file mode 100644 index 000000000..a7d978886 --- /dev/null +++ b/scipost_django/journals/migrations/0139_alter_journal_assignment_period.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.15 on 2024-10-25 10:58 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("journals", "0138_journal_assignment_period"), + ] + + operations = [ + migrations.AlterField( + model_name="journal", + name="assignment_period", + field=models.DurationField(default=datetime.timedelta(days=56)), + ), + ] diff --git a/scipost_django/journals/models/journal.py b/scipost_django/journals/models/journal.py index 2f91d41d3..60b84d845 100644 --- a/scipost_django/journals/models/journal.py +++ b/scipost_django/journals/models/journal.py @@ -84,7 +84,7 @@ class Journal(models.Model): ) refereeing_period = models.DurationField(default=datetime.timedelta(days=28)) - assignment_period = models.DurationField(default=datetime.timedelta(days=28)) + assignment_period = models.DurationField(default=datetime.timedelta(days=8 * 7)) style = models.TextField( blank=True, diff --git a/scipost_django/scipost/templates/scipost/personal_page/_hx_submissions.html b/scipost_django/scipost/templates/scipost/personal_page/_hx_submissions.html index 43b90e8d9..a8fa4e72b 100644 --- a/scipost_django/scipost/templates/scipost/personal_page/_hx_submissions.html +++ b/scipost_django/scipost/templates/scipost/personal_page/_hx_submissions.html @@ -1,5 +1,6 @@ -{% include 'scipost/personal_page/_hx_tablist.html' with selected='submissions' %} +{% load common_extras %} +{% include 'scipost/personal_page/_hx_tablist.html' with selected='submissions' %} <div class="row"> <div class="col-12"> @@ -45,8 +46,8 @@ <li><a class="btn btn-primary my-1 px-1 py-0" href="{% url 'submissions:accept_puboffer' sub.preprint.identifier_w_vn_nr %}">Accept offer for publication in {{ sub.editorial_decision.for_journal }} (one-click action)</a></li> {% endif %} {% endif %} - {% if sub.editor_in_charge is None and sub.nearing_assignment_deadline and not sub.has_extended_assignment_deadline %} - <li><a href="{% url 'submissions:extend_assignment_deadline' sub.preprint.identifier_w_vn_nr %}">Extend assignment deadline (by {{ sub.submitted_to.assignment_period.days }} days)</a></li> + {% if sub.editor_in_charge is None and sub.nearing_default_assignment_deadline and not sub.has_extended_assignment_deadline %} + <li><a href="{% url 'submissions:extend_assignment_deadline' sub.preprint.identifier_w_vn_nr %}">Extend assignment deadline (by {{ sub.submitted_to.assignment_period.days|int_divide:2 }} days)</a></li> {% endif %} <li><a href="{% url 'submissions:withdraw_manuscript' sub.preprint.identifier_w_vn_nr %}"><span class="text-danger">Withdraw</span> (leads to confirmation page)</a></li> {% endif %} diff --git a/scipost_django/submissions/management/commands/send_assignment_stage_update.py b/scipost_django/submissions/management/commands/send_assignment_stage_update.py index 5c53b2eee..e12982864 100644 --- a/scipost_django/submissions/management/commands/send_assignment_stage_update.py +++ b/scipost_django/submissions/management/commands/send_assignment_stage_update.py @@ -13,14 +13,20 @@ from ...models import Submission class Command(BaseCommand): help = "Sends all email reminders needed for Submissions in the assignment stage" + # Skip some weeks to avoid sending too many reminders + WEEKS_TO_SKIP = [3, 5, 8, 10] + def handle(self, *args, **options): submission: Submission for submission in Submission.objects.seeking_assignment(): now = timezone.now() today = now.date() - # Skip if assignment deadline is not set - if submission.assignment_deadline is None: + # Skip if assignment deadline is not set or in the past + if ( + submission.assignment_deadline is None + or submission.assignment_deadline < today + ): continue # If the date of passing preassignment checks is not set, set it to now @@ -39,7 +45,11 @@ class Command(BaseCommand): weeks_until_assignment_deadline = days_remaining // 7 # Send reminders after preassignment checks are cleared and only at 7-day intervals - if weeks_passed <= 0 or days_passed % 7 != 0: + if ( + weeks_passed <= 0 + or weeks_passed in self.WEEKS_TO_SKIP + or days_passed % 7 != 0 + ): continue # Send regular reminders if assignment deadline is not passed @@ -48,21 +58,20 @@ class Command(BaseCommand): f"authors/update_authors_assignment_stage", submission=submission, weeks_passed=weeks_passed, - should_include_appraisals=weeks_passed == 1, weeks_until_assignment_deadline=weeks_until_assignment_deadline, default_assignment_period_weeks=default_assignment_period_weeks, ) # Automatically fail assignment if the deadline is passed - else: - submission.status = Submission.ASSIGNMENT_FAILED - submission.visible_pool = False - submission.visible_public = False - submission.save() - - mail = DirectMailUtil( - "authors/submissions_assignment_failed", - submission=submission, - ) + # else: + # submission.status = Submission.ASSIGNMENT_FAILED + # submission.visible_pool = False + # submission.visible_public = False + # submission.save() + + # mail = DirectMailUtil( + # "authors/submissions_assignment_failed", + # submission=submission, + # ) mail.send_mail() diff --git a/scipost_django/submissions/models/submission.py b/scipost_django/submissions/models/submission.py index dcfe638a1..1a84cc556 100644 --- a/scipost_django/submissions/models/submission.py +++ b/scipost_django/submissions/models/submission.py @@ -756,17 +756,16 @@ class Submission(models.Model): ).exists() @property - def nearing_assignment_deadline(self): + def nearing_default_assignment_deadline(self): """ Check if Submission is nearing its assignment deadline. - Returns True if more than half of the default assignment period has elapsed. + Returns True if there are less than two weeks left until the journal's assignment deadline. """ - if self.assignment_deadline is None: + if self.checks_cleared_date is None: return False - today = timezone.now().date() - days_remaining = (self.assignment_deadline - today).days - return days_remaining <= (self.submitted_to.assignment_period.days // 2) + days_passed = (timezone.now().date() - self.checks_cleared_date.date()).days + return days_passed >= self.submitted_to.assignment_period.days - 2 * 7 @property def reporting_deadline_has_passed(self): diff --git a/scipost_django/submissions/views/__init__.py b/scipost_django/submissions/views/__init__.py index 5e1d61aa3..d8c671d1c 100644 --- a/scipost_django/submissions/views/__init__.py +++ b/scipost_django/submissions/views/__init__.py @@ -636,7 +636,8 @@ def extend_assignment_deadline( extension_date = ( submission.assignment_deadline + timedelta(days=days) if days is not None and is_edadmin(request.user) - else submission.assignment_deadline + submission.submitted_to.assignment_period + else submission.assignment_deadline + + (submission.submitted_to.assignment_period // 2) ) if extension_date < submission.assignment_deadline: diff --git a/scipost_django/templates/email/authors/update_authors_assignment_stage.html b/scipost_django/templates/email/authors/update_authors_assignment_stage.html index 8f88ab962..ab86aac12 100644 --- a/scipost_django/templates/email/authors/update_authors_assignment_stage.html +++ b/scipost_django/templates/email/authors/update_authors_assignment_stage.html @@ -1,3 +1,5 @@ +{% load common_extras %} + <p>Dear {{ submission.submitted_by.profile.formal_name }},</p> <p>We would hereby like to give you an update on your recent SciPost submission,</p> <p> @@ -7,10 +9,10 @@ </p> <p> - Your Submission is in the "seeking assignment" stage, where unfortunately no Editor-in-charge has yet volunteered to take charge of your Submission. At SciPost, Editorial Fellows choose which Submissions they wish to handle according to their interests, expertise and availability. While in this stage, your Submission will be visible to all Fellows, who may choose to take charge at any time. If this occurs, you will be immediately informed and the refereeing process will begin. Otherwise, we will keep searching for an Editor-in-charge and keep you informed of any new developments. + Your Submission is in the "seeking assignment" stage, where unfortunately no Editor-in-charge has yet volunteered to take charge of your Submission. At SciPost, Editorial Fellows choose which Submissions they wish to handle according to their interests, expertise and availability. While in this stage, your Submission will be visible to all Fellows with a matching specialty, who may choose to take charge at any time. When this occurs, you will be immediately informed and the refereeing process will begin. </p> -{% if should_include_appraisals and submission.qualification_set.exists %} +{% if weeks_passed == "1" and submission.qualification_set.exists %} <p> Over the past week, your submission has been examined by {{ submission.qualification_set.all|length }} Fellow{{ submission.qualification_set.all|pluralize }}, but there was no volunteer among them willing to take charge. </p> @@ -42,31 +44,29 @@ </p> {% endif %} -{% if submission.nearing_assignment_deadline %} +{% if submission.nearing_default_assignment_deadline %} <p> - We would like to inform you that the maximal duration of the assignment stage for submissions to {{ submission.submitted_to.name }} is {{ default_assignment_period_weeks }} weeks. Since {{ weeks_passed }} week{{ weeks_passed|pluralize }} {{ weeks_passed|pluralize:"has,have" }} already passed, we would like to further present you with the following options: + We strive to assign an Editor in Charge within a week of submission. If that is not possible, we continue searching for an appropriate and available editor for up to {{ default_assignment_period_weeks }} weeks for submissions to {{ submission.submitted_to.name }}. Since {{ weeks_passed }} week{{ weeks_passed|pluralize }} {{ weeks_passed|pluralize:"has,have" }} already passed, we would like to further present you with the following options: <ul> <li> - Wait until the nominal duration of the assignment stage is reached ({{ weeks_until_assignment_deadline }} week{{ weeks_until_assignment_deadline|pluralize }} remaining), while we keep searching for an Editor-in-charge. Your submission will be readily visible to our Fellows where they can choose to volunteer at any time. - Furthermore, when the deadline is reached, your submission will be returned to you, freeing you to submit it elsewhere. + You can wait until the nominal duration of the assignment stage is reached ({{ weeks_until_assignment_deadline }} week{{ weeks_until_assignment_deadline|pluralize }} remaining), while we keep searching for an Editor-in-charge. Your submission will be readily visible to our Fellows where they can choose to volunteer at any time. When the deadline is reached, your submission will be returned to you, freeing you to submit it elsewhere. </li> <!-- Deadline extension option, only if not already extended --> {% if not submission.has_extended_assignment_deadline %} <li> - You may choose to have the <a href="https://{{ domain }}{% url 'submissions:extend_assignment_deadline' submission.preprint.identifier_w_vn_nr %}">assignment stage deadline extended</a> by an additional {{ default_assignment_period_weeks }} weeks. Note that this extension may only happen once. + You can <a href="https://{{ domain }}{% url 'submissions:extend_assignment_deadline' submission.preprint.identifier_w_vn_nr %}">extend the assignment stage deadline</a> by an additional {{ default_assignment_period_weeks|int_divide:2 }} weeks. Note that this extension may only happen once. </li> {% else %} <li> - You have already extended the assignment stage once, and no more extensions are permitted. - At this point, you may <a href="mailto:edadmin@{{ domain }}">contact Editorial Administration</a> to discuss the situation and determine if any additional extension can be granted. + You have already extended the assignment stage once. If you would like to request a further extension, please <a href="https://{{ domain }}{% url 'submissions:communication' submission.preprint.identifier_w_vn_nr 'AtoS' %}">contact Editorial Administration</a> (login required) to discuss this possibility. </li> {% endif %} <li> - You may prematurely <a href="https://{{ domain }}{% url 'submissions:withdraw_manuscript' submission.preprint.identifier_w_vn_nr %}">withdraw your Submission</a> and seek an alternative venue. You can also do this at any time from your personal page, under the Submissions tab. + You can elect to <a href="https://{{ domain }}{% url 'submissions:withdraw_manuscript' submission.preprint.identifier_w_vn_nr %}">withdraw your Submission</a> (e.g. if you wish to seek an alternative venue). This action can be performed at any time from your personal page, under the Submissions tab. </li> </ul> @@ -74,7 +74,7 @@ {% endif %} <p> - We thank you for your patience and understanding. Please do not hesitate to contact us if you have any questions or concerns at <a href="mailto:edadmin@{{ domain }}">edadmin@{{ domain }}</a>. + We thank you for your patience and understanding. If you have any questions or concerns, please do not hesitate to <a href="https://{{ domain }}{% url 'submissions:communication' submission.preprint.identifier_w_vn_nr 'AtoS' %}">contact Editorial Administration</a> (login required). </p> <p>Sincerely,</p> -- GitLab