diff --git a/smash/web/tests/view/test_notifications.py b/smash/web/tests/view/test_notifications.py index 677ce30bec0e8d5481fcba8972406ec861b06ee9..e02b515089640176d13e3b57c13c0b7a902a64b8 100644 --- a/smash/web/tests/view/test_notifications.py +++ b/smash/web/tests/view/test_notifications.py @@ -286,6 +286,16 @@ class NotificationViewTests(LoggedInTestCase): notification = get_unfinished_appointments_count(self.user) self.assertEquals(original_notification.count + 1, notification.count) + def test_get_unfinished_appointments_count_for_general_appointments(self): + appointment = create_appointment() + appointment.visit = None + appointment.datetime_when = "2011-01-01" + appointment.status = Appointment.APPOINTMENT_STATUS_SCHEDULED + appointment.save() + + notification = get_unfinished_appointments_count(self.user) + self.assertEquals(0, notification.count) + def test_get_unfinished_appointments_count_2(self): original_notification = get_unfinished_appointments_count(self.user) subject = create_study_subject() diff --git a/smash/web/views/notifications.py b/smash/web/views/notifications.py index 4d251909544bc61cacaade3a0a309e9b4caa39b8..2ef58548948192fb1b4fb4d606858c8eba81a85c 100644 --- a/smash/web/views/notifications.py +++ b/smash/web/views/notifications.py @@ -235,7 +235,7 @@ def get_unfinished_appointments(user): datetime_when__lt=get_today_midnight_date(), status=Appointment.APPOINTMENT_STATUS_SCHEDULED, location__in=get_filter_locations(user), - ).order_by('datetime_when') + ).exclude(visit__isnull=True).order_by('datetime_when') def waiting_for_appointment(visit):