From: Yoan Le Clanche Date: Wed, 26 Sep 2018 15:48:06 +0000 (+0200) Subject: change appointment link condition X-Git-Tag: 1.4.0~38 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=4f03efd50e736dc83c6c7e4844635c71492f73f4;p=teleforma.git change appointment link condition --- diff --git a/teleforma/views/core.py b/teleforma/views/core.py index f74b9700..17882575 100644 --- a/teleforma/views/core.py +++ b/teleforma/views/core.py @@ -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: