From c3e65018ed144d48a6621d6350446839ddbe9fd0 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Tue, 29 Jan 2019 05:26:37 +0100
Subject: [PATCH] Add potfel voting to fellows tasklist email

---
 submissions/management/commands/email_fellows_tasklist.py | 3 +++
 templates/email/fellows/email_fellow_tasklist.html        | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/submissions/management/commands/email_fellows_tasklist.py b/submissions/management/commands/email_fellows_tasklist.py
index b951e3785..26d869796 100644
--- a/submissions/management/commands/email_fellows_tasklist.py
+++ b/submissions/management/commands/email_fellows_tasklist.py
@@ -6,6 +6,7 @@ from django.core.management import BaseCommand
 
 from ...models import EICRecommendation
 
+from colleges.models import PotentialFellowship
 from mails.utils import DirectMailUtil
 from scipost.models import Contributor
 
@@ -20,6 +21,7 @@ class Command(BaseCommand):
         count = 0
 
         for fellow in fellows:
+            nr_potfels_to_vote_on = PotentialFellowship.objects.to_vote_on(fellow).count()
             recs_to_vote_on = EICRecommendation.objects.user_must_vote_on(fellow.user)
             assignments_ongoing = fellow.editorial_assignments.ongoing()
             assignments_to_consider = fellow.editorial_assignments.invited()
@@ -28,6 +30,7 @@ class Command(BaseCommand):
                 mail_sender = DirectMailUtil(
                     mail_code='fellows/email_fellow_tasklist',
                     fellow=fellow,
+                    nr_potfels_to_vote_on=nr_potfels_to_vote_on,
                     recs_to_vote_on=recs_to_vote_on,
                     assignments_ongoing=assignments_ongoing,
                     assignments_to_consider=assignments_to_consider,
diff --git a/templates/email/fellows/email_fellow_tasklist.html b/templates/email/fellows/email_fellow_tasklist.html
index ce32373eb..f0fc50dba 100644
--- a/templates/email/fellows/email_fellow_tasklist.html
+++ b/templates/email/fellows/email_fellow_tasklist.html
@@ -2,6 +2,12 @@
 
 <p>Please find below a summary of your current assignments, with (if applicable) pending and upcoming required actions. Many thanks in advance for your timely intervention on any point in need of attention. Your good work as an Editorial Fellow is greatly appreciated!</p>
 
+{% if nr_potfels_to_vote_on > 0 %}
+<br/>
+<h3>Nominations to the Editorial College</h3>
+<p>You have {{ nr_potfels_to_vote_on }} nomination{{ nr_potfels_to_vote_on|pluralize }} to vote on, please visit the <a href="{% url 'colleges:potential_fellowships' %}">Potential Fellowships</a> page to cast your vote{{ nr_potfels_to_vote_on|pluralize }}.</p>
+{% endif %}
+
 {% if recs_to_vote_on %}
     <br/>
     <h3>Recommendations for you to vote on</h3>
-- 
GitLab