From da3aef83677266261263ceca47ac460ac62e1660 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Wed, 6 Dec 2017 16:29:16 +0100 Subject: [PATCH] make sure that notifications are only for alive people --- smash/web/views/notifications.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/smash/web/views/notifications.py b/smash/web/views/notifications.py index c698553b..0fac2b49 100644 --- a/smash/web/views/notifications.py +++ b/smash/web/views/notifications.py @@ -183,6 +183,8 @@ def get_approaching_visits_without_appointments(user): today_plus_two_months = today + datetime.timedelta(days=91) return Visit.objects.annotate( my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( + subject__subject__dead=False, + subject__resigned=False, datetime_begin__gt=today, datetime_begin__lt=today_plus_two_months, is_finished=False, @@ -196,6 +198,8 @@ def get_approaching_visits_for_mail_contact(user): today_plus_six_months = today + datetime.timedelta(days=183) return Visit.objects.annotate( my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( + subject__subject__dead=False, + subject__resigned=False, datetime_begin__gt=today_plus_three_months, datetime_begin__lt=today_plus_six_months, is_finished=False, -- GitLab