diff --git a/smash/web/views/notifications.py b/smash/web/views/notifications.py index c698553b8ba8f1cb4b8e8ebedda0d4f45d0810eb..0fac2b49f48023ea219af4a000565edea2b2764e 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,