diff --git a/submissions/management/commands/email_fellows_tasklist.py b/submissions/management/commands/email_fellows_tasklist.py index efeb5eb7be4ebea5b73a696250fb920c9421e923..1dce36913618407852eb596076ca36bbe10e996a 100644 --- a/submissions/management/commands/email_fellows_tasklist.py +++ b/submissions/management/commands/email_fellows_tasklist.py @@ -14,12 +14,16 @@ class Command(BaseCommand): ).order_by('user__last_name') for fellow in fellows: - submissions_as_eic = Submission.objects.filter_for_eic( - fellow.user).order_by('submission_date') - assignments_to_consider = EditorialAssignment.objects.open().filter( - to=fellow) - if submissions_as_eic or assignments_to_consider: - SubmissionUtils.load({'fellow': fellow, - 'submissions_as_eic': submissions_as_eic, - 'assignments_to_consider': assignments_to_consider,}) + assignments_ongoing = fellow.editorial_assignments.ongoing() + assignments_to_consider = fellow.editorial_assignments.open() + assignments_upcoming_deadline = fellow.editorial_assignments_deadline_within(days=7) + if assignments_ongoing or assignments_to_consider or assignments_upcoming_deadline: + SubmissionUtils.load( + { + 'fellow': fellow, + 'assignments_ongoing': assignments_ongoing, + 'assignments_to_consider': assignments_to_consider, + 'assignments_upcoming_deadline': assignments_upcoming_deadline, + } + ) SubmissionUtils.email_Fellow_tasklist() diff --git a/submissions/managers.py b/submissions/managers.py index e85f7218cbfaf72c5d5479d5b316e59a8aab5c87..1c8db3f2c9fd6022e4a1d45bb21e444317df7313 100644 --- a/submissions/managers.py +++ b/submissions/managers.py @@ -50,7 +50,7 @@ class SubmissionQuerySet(models.QuerySet): def _pool(self, user): """ - This filter creates 'the complete pool' for an user. This new-style pool does + This filter creates 'the complete pool' for a user. This new-style pool does explicitly not have the author filter anymore, but registered pools for every Submission. !!! IMPORTANT SECURITY NOTICE !!! @@ -256,6 +256,11 @@ class EditorialAssignmentQuerySet(models.QuerySet): def open(self): return self.filter(accepted=None, deprecated=False) + def refereeing_deadline_within(self, days=7): + return self.exclude( + submission__reporting_deadline_gt=timezone.now() + timezone.timedelta(days=days) + ).exclude(submission__reporting_deadline_lt=timezone.now()) + class EICRecommendationQuerySet(models.QuerySet): def get_for_user_in_pool(self, user): diff --git a/templates/email/email_fellow_tasklist.html b/templates/email/email_fellow_tasklist.html index 4f555a08a26e31911e015aaadce7531885376277..197296867b2d135108ae037db9b07ea40b9e2f80 100644 --- a/templates/email/email_fellow_tasklist.html +++ b/templates/email/email_fellow_tasklist.html @@ -1,6 +1,7 @@ +{% load bootstrap %} {% load submissions_extras %} <p>Dear {{ fellow.get_title_display }} {{ fellow.user.last_name }},</p> -<p>Please find below a digest of your pending and upcoming required actions as SciPost Fellow. Many thanks in advance for your timely invervention.</p> +<p>Please find below a digest of your current assignments, with pending and upcoming required actions. Many thanks in advance for your timely invervention.</p> {% if assignments_to_consider %} <h3>Assignments for you to consider:</h3> <ul> @@ -11,21 +12,38 @@ {% endfor %} </ul> {% endif %} -{% if submissions_as_eic %} -<h3>Submissions for which you are Editor-in-charge:</h3> +{% if assignments_ongoing %} +<h3>Current assignments (Submissions for which you are Editor-in-charge):</h3> <ul> -{% for submission in submissions_as_eic %} -<li> -<div class="pool-item"> - <p class="mb-1"> - <a href="{% url 'submissions:pool' submission.arxiv_identifier_w_vn_nr %}">{{ submission.title }}</a><br> - <em>by {{ submission.author_list }}</em> - </p> - <p><a href="{% url 'submissions:editorial_page' submission.arxiv_identifier_w_vn_nr %}">Go to this Submission's Editorial page</a></p> - {% include 'submissions/_required_actions_block.html' with submission=submission %} -</div> -</li> -{% endfor %} + {% for assignment in assignments_ongoing %} + <li> + <div class="pool-item"> + <p class="mb-1"> + <a href="{% url 'submissions:pool' assignment.submission.arxiv_identifier_w_vn_nr %}">{{ assignment.submission.title }}</a><br> + <em>by {{ assignment.submission.author_list }}</em> + </p> + <p><a href="{% url 'submissions:editorial_page' assignment.submission.arxiv_identifier_w_vn_nr %}">Go to this Submission's Editorial page</a></p> + {% include 'submissions/_required_actions_block.html' with submission=assignment.submission %} + </div> + </li> + {% endfor %} +</ul> +{% endif %} +{% if assignments_upcoming_deadline %} +<h3>Upcoming refereeing deadlines:</h3> +<ul> + {% for assignment in assignments_upcoming_deadline %} + <li> + <div class="pool-item"> + <p class="mb-1"> + <a href="{% url 'submissions:pool' assignment.submission.arxiv_identifier_w_vn_nr %}">{{ assignment.submission.title }}</a><br> + <em>by {{ assignment.submission.author_list }}</em> + </p> + <p>Refereeing deadline: {{ assignment.submission.reporting_deadline|date:"Y-m-d" }}.</p> + <p><a href="{% url 'submissions:editorial_page' assignment.submission.arxiv_identifier_w_vn_nr %}">Go to this Submission's Editorial page</a></p> + </div> + </li> + {% endfor %} </ul> {% endif %} <p> diff --git a/templates/email/email_fellow_tasklist.txt b/templates/email/email_fellow_tasklist.txt index 3cc75670c70e036c4d256d53feb68e9916239cfb..5e6fb41558e9794e510f3d01726803bf687c03ba 100644 --- a/templates/email/email_fellow_tasklist.txt +++ b/templates/email/email_fellow_tasklist.txt @@ -1,6 +1,6 @@ {% load submissions_extras %} Dear {{ fellow.get_title_display }} {{ fellow.user.last_name }},\n\n -Please find below a digest of your pending and upcoming required actions as SciPost Fellow. Many thanks in advance for your timely invervention.\n\n +Please find below a digest of your current assignments, with pending and upcoming required actions. Many thanks in advance for your timely invervention.\n\n {% if assignments_to_consider %} Assignments for you to consider:\n\n {% for assignment in assignments_to_consider %} @@ -8,14 +8,14 @@ On submission: {{ assignment.submission }}\n Accept or decline at {% url 'submissions:assignment_request' assignment.id %}" {% endfor %} {% endif %} -{% if submissions_as_eic %} -Submissions for which you are Editor-in-charge:\n\n -{% for submission in submissions_as_eic %} -{{ submission.title }}\n -by {{ submission.author_list }}\n\n -{% if submission.cycle.has_required_actions %} +{% if assignments_ongoing %} +Current assignments (Submissions for which you are Editor-in-charge):\n\n +{% for assignment in assignments_ongoing %} +{{ assignment.submission.title }}\n +by {{ assignment.submission.author_list }}\n\n +{% if assignment.submission.cycle.has_required_actions %} Required actions:\n -{% for action in submission.cycle.get_required_actions %} +{% for action in assignment.submission.cycle.get_required_actions %} {{action.1}}\n {% empty %} No actions required\n @@ -24,6 +24,15 @@ No actions required\n {% endfor %} {% endif %} \n +{% if assignments_upcoming_deadline %} +Upcoming refereeing deadlines:\n\n +{% for assignment in assignments_upcoming_deadline %} +{{ assignment.submission.title }}\n +by {{ assignment.submission.author_list }}\n +Refereeing deadline: {{ assignment.submission.reporting_deadline|date:"Y-m-d" }}.\n +{% endfor %} +{% endif %} +\n You can take action on all of these starting from your personal page at https://scipost.org/personal_page. Don't hesitate to email the editorial administration at edadmin@scipost.org if you need any assistance.\n\n Many thanks,\n The SciPost Team.