From 2536936ed38d09798f6ef2c02a9440bbf54cc5ae Mon Sep 17 00:00:00 2001 From: Carlos Vega <carlos.vega@uni.lu> Date: Fri, 2 Nov 2018 18:04:31 +0100 Subject: [PATCH] considered new property 'excluded' from study subject --- smash/web/tests/functions.py | 1 + smash/web/views/notifications.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/smash/web/tests/functions.py b/smash/web/tests/functions.py index 617756cb..923ce0b3 100644 --- a/smash/web/tests/functions.py +++ b/smash/web/tests/functions.py @@ -56,6 +56,7 @@ def create_empty_study_columns(): information_sent=False, pd_in_family=False, resigned=False, + excluded=False, resign_reason=False, ) diff --git a/smash/web/views/notifications.py b/smash/web/views/notifications.py index 64b2ebf2..caadc058 100644 --- a/smash/web/views/notifications.py +++ b/smash/web/views/notifications.py @@ -185,7 +185,7 @@ def get_subjects_with_almost_expired_vouchers(user): contact_attempt_min_date = get_today_midnight_date() - datetime.timedelta(days=7) result = StudySubject.objects.filter( subject__dead=False, - resigned=False, + resigned=False, excluded=False, default_location__in=get_filter_locations(user), ).annotate(last_contact=Max(Case(When(contactattempt__success=True, then="contactattempt__datetime_when")))).filter( Q(vouchers__status=VOUCHER_STATUS_NEW) & Q(vouchers__expiry_date__lte=notification_min_date)).filter( @@ -198,7 +198,7 @@ def get_subjects_with_reminder(user): result = StudySubject.objects.filter( subject__dead=False, - resigned=False, + resigned=False, excluded=False, default_location__in=get_filter_locations(user), datetime_contact_reminder__lt=tomorrow, ) @@ -222,6 +222,7 @@ def get_approaching_visits_without_appointments(user): my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( subject__subject__dead=False, subject__resigned=False, + subject__excluded=False, datetime_begin__gt=today, datetime_begin__lt=today_plus_two_months, is_finished=False, @@ -237,6 +238,7 @@ def get_approaching_visits_for_mail_contact(user): my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( subject__subject__dead=False, subject__resigned=False, + subject__excluded=False, datetime_begin__gt=today_plus_three_months, datetime_begin__lt=today_plus_six_months, is_finished=False, -- GitLab