Allow to reschedule a missed email

This commit is contained in:
Raphael Michel
2021-12-06 17:36:49 +01:00
parent 8038f4e173
commit e1f924c4ce
2 changed files with 2 additions and 2 deletions

View File

@@ -71,7 +71,7 @@ class ScheduledMail(models.Model):
super().save(**kwargs)
def recompute(self):
if self.state in (self.STATE_COMPLETED, self.STATE_MISSED):
if self.state == self.STATE_COMPLETED:
return
if self.rule.date_is_absolute:

View File

@@ -389,7 +389,7 @@ class UpdateRule(EventPermissionRequiredMixin, UpdateView):
return get_object_or_404(
Rule.objects.annotate(
total_mails=Count('scheduledmail'),
sent_mails=Count('scheduledmail', filter=Q(scheduledmail__state__in=(ScheduledMail.STATE_COMPLETED, ScheduledMail.STATE_MISSED))),
sent_mails=Count('scheduledmail', filter=Q(scheduledmail__state=ScheduledMail.STATE_COMPLETED)),
),
event=self.request.event,
id=self.kwargs['rule']