From 3e444908367f1c81915f862db04f391de93aa196 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sat, 10 Nov 2018 06:18:58 +0100
Subject: [PATCH] Add warning about ref deadline in select_referee

---
 submissions/templates/submissions/select_referee.html | 3 +++
 submissions/views.py                                  | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/submissions/templates/submissions/select_referee.html b/submissions/templates/submissions/select_referee.html
index d2403e4fe..f9f5adc18 100644
--- a/submissions/templates/submissions/select_referee.html
+++ b/submissions/templates/submissions/select_referee.html
@@ -72,6 +72,9 @@
 
 <div class="row">
   <div class="col-12">
+    {% if workdays_left_to_report < 15 %}
+    <h4 class="highlight p-1"><strong class="text-danger">Warning: there are {{ workdays_left_to_report }} days left before the refereeing deadline.</strong><br/><br/>Consider resetting the deadline at the <a href="{% url 'submissions:editorial_page' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}">Editorial Page</a> before inviting a referee.</h4>
+    {% endif %}
     {% if profiles_found %}
     <h3>Matching people in our database:</h3>
     <table class="table">
diff --git a/submissions/views.py b/submissions/views.py
index 0d9cfec0f..e6d0ede8e 100644
--- a/submissions/views.py
+++ b/submissions/views.py
@@ -45,6 +45,7 @@ from .utils import SubmissionUtils
 from colleges.permissions import fellowship_required, fellowship_or_admin_required
 from comments.forms import CommentForm
 from common.helpers import get_new_secrets_key
+from common.utils import workdays_between
 from invitations.constants import STATUS_SENT
 from invitations.models import RegistrationInvitation
 from journals.models import Journal
@@ -898,6 +899,7 @@ def select_referee(request, identifier_w_vn_nr):
         context['profile_form'] = SimpleProfileForm()
     context.update({
         'submission': submission,
+        'workdays_left_to_report': workdays_between(timezone.now(), submission.reporting_deadline),
         'referee_search_form': referee_search_form,
         'queryresults': queryresults,
     })
-- 
GitLab