]> git.parisson.com Git - teleforma.git/commitdiff
cleanup
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 25 Jan 2021 16:42:17 +0000 (17:42 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 25 Jan 2021 16:42:17 +0000 (17:42 +0100)
teleforma/views/core.py

index 220eaba7053f3fb013c7aebe8d4552ca41bd667b..83a6c3e6a2dabfac7112ba1e8ffff7ed291a60fc 100644 (file)
@@ -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: