SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 296acb9a authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Do not email Fellows with tasklist if there are no required actions

parent 33e91b02
No related branches found
No related tags found
No related merge requests found
...@@ -24,9 +24,11 @@ class Command(BaseCommand): ...@@ -24,9 +24,11 @@ class Command(BaseCommand):
nr_potfels_to_vote_on = PotentialFellowship.objects.to_vote_on(fellow).count() nr_potfels_to_vote_on = PotentialFellowship.objects.to_vote_on(fellow).count()
recs_to_vote_on = EICRecommendation.objects.user_must_vote_on(fellow.user) recs_to_vote_on = EICRecommendation.objects.user_must_vote_on(fellow.user)
assignments_ongoing = fellow.editorial_assignments.ongoing() assignments_ongoing = fellow.editorial_assignments.ongoing()
assignments_ongoing_with_required_actions = assignments_ongoing.with_required_actions()
assignments_to_consider = fellow.editorial_assignments.invited() assignments_to_consider = fellow.editorial_assignments.invited()
assignments_upcoming_deadline = assignments_ongoing.refereeing_deadline_within(days=7) assignments_upcoming_deadline = assignments_ongoing.refereeing_deadline_within(days=7)
if recs_to_vote_on or assignments_ongoing or assignments_to_consider or assignments_upcoming_deadline: if (recs_to_vote_on or assignments_ongoing_with_required_actions
or assignments_to_consider or assignments_upcoming_deadline):
mail_sender = DirectMailUtil( mail_sender = DirectMailUtil(
'fellows/email_fellow_tasklist', 'fellows/email_fellow_tasklist',
# Render immediately, because m2m/querysets cannot be saved for later rendering: # Render immediately, because m2m/querysets cannot be saved for later rendering:
......
...@@ -294,6 +294,10 @@ class EditorialAssignmentQuerySet(models.QuerySet): ...@@ -294,6 +294,10 @@ class EditorialAssignmentQuerySet(models.QuerySet):
def ongoing(self): def ongoing(self):
return self.filter(status=constants.STATUS_ACCEPTED) return self.filter(status=constants.STATUS_ACCEPTED)
def with_required_actions(self):
ids = [o.id for o in self if o.submission.cycle.has_required_actions()]
return self.filter(id__in=ids)
def accepted(self): def accepted(self):
return self.filter(status__in=[constants.STATUS_ACCEPTED, constants.STATUS_COMPLETED]) return self.filter(status__in=[constants.STATUS_ACCEPTED, constants.STATUS_COMPLETED])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment