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

notifications should be visible to everybody

parent b214875c
No related branches found
No related tags found
1 merge request!31Tests added
......@@ -92,23 +92,21 @@ def get_unfinished_appointments_count(user):
def get_notifications(the_user):
workers = Worker.objects.filter(user=the_user)
worker = Worker.get_by_user(the_user)
notifications = []
count = 0
if len(workers) > 0:
person = workers[0]
if person.role == Worker.ROLE_CHOICES_SECRETARY:
notifications.append(get_exceeded_visit_notifications_count(person))
notifications.append(get_visits_without_appointments_count(person))
notifications.append(get_approaching_visits_without_appointments_count(person))
notifications.append(get_unfinished_appointments_count(person))
notifications.append(get_visits_with_missing_appointments_count(person))
notifications.append(get_subject_with_no_visit_notifications_count(person))
notifications.append(get_approaching_visits_for_mail_contact_count(person))
notifications.append(get_subjects_with_reminder_count(person))
for notification in notifications:
count += notification.count
if worker is not None:
notifications.append(get_exceeded_visit_notifications_count(worker))
notifications.append(get_visits_without_appointments_count(worker))
notifications.append(get_approaching_visits_without_appointments_count(worker))
notifications.append(get_unfinished_appointments_count(worker))
notifications.append(get_visits_with_missing_appointments_count(worker))
notifications.append(get_subject_with_no_visit_notifications_count(worker))
notifications.append(get_approaching_visits_for_mail_contact_count(worker))
notifications.append(get_subjects_with_reminder_count(worker))
for notification in notifications:
count += notification.count
return count, notifications
......
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