From 534b65e342ade3bdf59c87321cd2ca66f0a24e54 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sat, 28 Apr 2018 21:07:10 +0200
Subject: [PATCH] Update invitations nr_reminders upon auto-reminding

---
 .../management/commands/send_refereeing_reminders.py      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/submissions/management/commands/send_refereeing_reminders.py b/submissions/management/commands/send_refereeing_reminders.py
index 42b9f88b3..cc5b6b4b3 100644
--- a/submissions/management/commands/send_refereeing_reminders.py
+++ b/submissions/management/commands/send_refereeing_reminders.py
@@ -31,6 +31,9 @@ class Command(BaseCommand):
                             mail_code='referees/invite_unregistered_to_referee_reminder1',
                             instance=invitation)
                         mail_sender.send()
+                    invitation.nr_reminders += 1
+                    invitation.date_last_reminded = timezone.now()
+                    invitation.save()
                 # second (and final) reminder after 4 days
                 if workdays_between(invitation.date_invited, timezone.now()) == 4:
                     if invitation.referee:
@@ -43,12 +46,15 @@ class Command(BaseCommand):
                             mail_code='referees/invite_unregistered_to_referee_reminder2',
                             instance=invitation)
                         mail_sender.send()
+                    invitation.nr_reminders += 1
+                    invitation.date_last_reminded = timezone.now()
+                    invitation.save()
 
             # after 6 days of no response, EIC is automatically emailed
             # with the suggestion of removing and replacing this referee
             # TODO
             # one week before refereeing deadline: auto email reminder to ref
-            if workdays_between (timezone.now(), submission.reporting_deadline) == 5:
+            if workdays_between(timezone.now(), submission.reporting_deadline) == 5:
                 for invitation in submission.refereeing_invitations.in_process():
                     mail_sender = DirectMailUtil(mail_code='referees/remind_referee_deadline_1week',
                                                  instance=invitation)
-- 
GitLab