From c0676dd2cc5eb203ae80e0fa7e5f4120650f0f30 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 25 Jan 2021 17:42:17 +0100 Subject: [PATCH] cleanup --- teleforma/views/core.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/teleforma/views/core.py b/teleforma/views/core.py index 220eaba7..83a6c3e6 100644 --- a/teleforma/views/core.py +++ b/teleforma/views/core.py @@ -230,27 +230,6 @@ class CourseListView(CourseAccessMixin, ListView): context['courses'] = sorted(context['all_courses'], key=lambda k: k['date'], reverse=True)[:1] user = self.request.user is_student = user.student.all().count() - # appointments_open = False - appointments = [] - if is_student: - available_courses = [course['course'] for course in context['all_courses']] - for appointment in AppointmentPeriod.objects.filter(periods=context['period'], course__in=available_courses): - if appointment.is_open: - found = False - for existing in appointments: - if existing.course == appointment.course: - found = True - if not found: - appointments.append(appointment) - context['appointments'] = appointments - # check if user appointment is next - user_appointment = Appointment.objects.filter(student=user, slot__mode='distance', slot__appointment_period__periods=context['period']) - if user_appointment: - user_appointment = user_appointment[0] - now = datetime.datetime.now() - # now = datetime.datetime(2020, 10, 29, 9, 00) - if user_appointment.real_date - datetime.timedelta(hours=1) < now < user_appointment.real_date + datetime.timedelta(hours=1): - context['current_appointement'] = user_appointment homes = Home.objects.filter(enabled = True).order_by('-modified_at') for home in homes: -- 2.39.5