From d58f58f23c2e7bc84dcd103cad19d45d5352ca54 Mon Sep 17 00:00:00 2001 From: Carlos Vega <carlos.vega@uni.lu> Date: Mon, 5 Nov 2018 11:11:15 +0100 Subject: [PATCH] format --- smash/web/views/notifications.py | 40 ++++++++++++++------------------ 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/smash/web/views/notifications.py b/smash/web/views/notifications.py index caadc058..d2843847 100644 --- a/smash/web/views/notifications.py +++ b/smash/web/views/notifications.py @@ -130,35 +130,27 @@ 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 @@ -172,7 +164,8 @@ def get_subjects_with_no_visit(user): resigned=False, unfinished_visit_count=0, default_location__in=get_filter_locations(user), - postponed=False, excluded=False, + excluded=False, + postponed=False datetime_contact_reminder__isnull=True, ).exclude(vouchers__status=VOUCHER_STATUS_NEW) return result @@ -185,7 +178,8 @@ 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, excluded=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 +192,8 @@ def get_subjects_with_reminder(user): result = StudySubject.objects.filter( subject__dead=False, - resigned=False, excluded=False, + resigned=False, + excluded=False, default_location__in=get_filter_locations(user), datetime_contact_reminder__lt=tomorrow, ) @@ -250,12 +245,10 @@ 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( @@ -337,3 +330,4 @@ def get_filter_locations(user): return Location.objects.all() else: return worker.locations.all() + -- GitLab