Skip to content
Snippets Groups Projects
Commit da3aef83 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

make sure that notifications are only for alive people

parent 5b7b917c
No related branches found
No related tags found
1 merge request!108Resolve "approaching visits list"
......@@ -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,
......
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