diff --git a/submissions/management/commands/email_fellows_tasklist.py b/submissions/management/commands/email_fellows_tasklist.py index 7425635d5187a336d97fa9832f2b8cd2261f6e10..dc63441b03d6884174a1a24b816cdce314ba5bae 100644 --- a/submissions/management/commands/email_fellows_tasklist.py +++ b/submissions/management/commands/email_fellows_tasklist.py @@ -24,9 +24,11 @@ class Command(BaseCommand): 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_ongoing_with_required_actions = assignments_ongoing.with_required_actions() assignments_to_consider = fellow.editorial_assignments.invited() 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( 'fellows/email_fellow_tasklist', # Render immediately, because m2m/querysets cannot be saved for later rendering: diff --git a/submissions/managers.py b/submissions/managers.py index 8c98a7b15e49abd80f8d13812f8d5291f21f2123..47e92f277f041c6d9d2882d8e6e4fbc03da98b26 100644 --- a/submissions/managers.py +++ b/submissions/managers.py @@ -294,6 +294,10 @@ class EditorialAssignmentQuerySet(models.QuerySet): def ongoing(self): 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): return self.filter(status__in=[constants.STATUS_ACCEPTED, constants.STATUS_COMPLETED])