]> git.parisson.com Git - teleforma.git/commitdiff
change appointment link condition
authorYoan Le Clanche <yoan@ellington.pilotsystems.net>
Wed, 26 Sep 2018 15:48:06 +0000 (17:48 +0200)
committerYoan Le Clanche <yoan@ellington.pilotsystems.net>
Wed, 26 Sep 2018 15:48:06 +0000 (17:48 +0200)
teleforma/views/core.py

index f74b9700f8a0bac86c3f9ab253ce3fb2387dad19..178825758ef3a60e69d90addaeae0f5e024c08ab 100644 (file)
@@ -332,7 +332,12 @@ class CourseListView(CourseAccessMixin, ListView):
         context['list_view'] = True
         context['courses'] = sorted(context['all_courses'], key=lambda k: k['date'], reverse=True)[:1]
         is_student = self.request.user.student.all().count()
-        context['hasAppointment'] = AppointmentPeriod.objects.filter(period=context['period']).count() and is_student
+        appointments = AppointmentPeriod.objects.filter(period=context['period'])
+        appointments_open = False
+        for appointment in appointments:
+            if appointment.is_open:
+                appointments_open = True
+        context['hasAppointment'] = appointments_open and is_student
 
         home = Home.objects.all()
         if home: