diff --git a/smash/web/views/notifications.py b/smash/web/views/notifications.py index 20246b9ecd1b4a674e7cf42437c0b63588b2bbb9..64b2ebf2441e4aff10ea418deff0d81b981281da 100644 --- a/smash/web/views/notifications.py +++ b/smash/web/views/notifications.py @@ -130,27 +130,35 @@ def get_notifications(the_user): if worker is not None: study = Study.objects.filter(id=GLOBAL_STUDY_ID)[0] if study.notification_parameters.exceeded_visits_visible: - notifications.append(get_exceeded_visit_notifications_count(worker)) + notifications.append( + get_exceeded_visit_notifications_count(worker)) if study.notification_parameters.unfinished_visits_visible: notifications.append(get_visits_without_appointments_count(worker)) if study.notification_parameters.approaching_visits_without_appointments_visible: - notifications.append(get_approaching_visits_without_appointments_count(worker)) + notifications.append( + get_approaching_visits_without_appointments_count(worker)) if study.notification_parameters.unfinished_appointments_visible: notifications.append(get_unfinished_appointments_count(worker)) if study.notification_parameters.visits_with_missing_appointments_visible: - notifications.append(get_visits_with_missing_appointments_count(worker)) + notifications.append( + get_visits_with_missing_appointments_count(worker)) if study.notification_parameters.subject_no_visits_visible: - notifications.append(get_subject_with_no_visit_notifications_count(worker)) + notifications.append( + get_subject_with_no_visit_notifications_count(worker)) if study.notification_parameters.subject_voucher_expiry_visible: - notifications.append(get_subject_voucher_expiry_notifications_count(worker)) + notifications.append( + get_subject_voucher_expiry_notifications_count(worker)) if study.notification_parameters.approaching_visits_for_mail_contact_visible: - notifications.append(get_approaching_visits_for_mail_contact_count(worker)) + notifications.append( + get_approaching_visits_for_mail_contact_count(worker)) if study.notification_parameters.subject_require_contact_visible: notifications.append(get_subjects_with_reminder_count(worker)) if study.notification_parameters.missing_redcap_subject_visible: - notifications.append(get_missing_redcap_subject_notification_count(worker)) + notifications.append( + get_missing_redcap_subject_notification_count(worker)) if study.notification_parameters.inconsistent_redcap_subject_visible: - notifications.append(get_inconsistent_redcap_subject_notification_count(worker)) + notifications.append( + get_inconsistent_redcap_subject_notification_count(worker)) for notification in notifications: count += notification.count @@ -164,7 +172,7 @@ def get_subjects_with_no_visit(user): resigned=False, unfinished_visit_count=0, default_location__in=get_filter_locations(user), - postponed=False, + postponed=False, excluded=False, datetime_contact_reminder__isnull=True, ).exclude(vouchers__status=VOUCHER_STATUS_NEW) return result @@ -240,10 +248,12 @@ def get_approaching_visits_for_mail_contact(user): def get_exceeded_visits(user): return Visit.objects.filter(datetime_end__lt=get_today_midnight_date(), is_finished=False, - subject__default_location__in=get_filter_locations(user) + subject__default_location__in=get_filter_locations( + user) ).filter( # by default any visit where visit number is bigger than 1 - # or in case of first visit - visits that had some successful appointment + # or in case of first visit - visits that had some successful + # appointment Q(visit_number__gt=1) | Q(appointment__status=Appointment.APPOINTMENT_STATUS_FINISHED)).filter( # visits that have scheduled appointments should be excluded ~Q(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED)).order_by( @@ -325,5 +335,3 @@ def get_filter_locations(user): return Location.objects.all() else: return worker.locations.all() - -