From dd546c648dd29ab6220d33eea39548f1a371c16b Mon Sep 17 00:00:00 2001 From: gzbender Date: Thu, 13 Dec 2018 00:26:48 +0500 Subject: [PATCH] =?UTF-8?q?LIL-720=20=D0=9E=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D0=B0=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B5=D0=B9?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D0=B5=D0=B4=D0=B8=D0=BD=D0=BE=D0=B9=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/school/views.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/school/views.py b/apps/school/views.py index 71029683..29d38622 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -179,12 +179,12 @@ class SchoolView(TemplateView): # берем все подписки, которые были в периоде for sp in prev_school_payments: # берем все уроки в оплаченном промежутке - date_range = [max(sp.date_start, prev_range[0]), min(sp.date_end, prev_range[1])] - prev_live_lessons = LiveLesson.objects.filter( + date_range = [max(sp.date_start, prev_range[0]), min(sp.date_end, prev_range[1] - timedelta(days=1))] + prev_live_lessons += list(LiveLesson.objects.filter( date__range=date_range, deactivated_at__isnull=True, date__week_day__in=list(map(lambda x: 1 if x == 7 else x+1, sp.weekdays)), - ).values_list('id', flat=True) + ).values_list('id', flat=True)) prev_live_lessons = LiveLesson.objects.filter(id__in=set(prev_live_lessons)).order_by('-date') prev_live_lessons_exists = prev_live_lessons.exists() if prev_live_lessons_exists: @@ -192,8 +192,6 @@ class SchoolView(TemplateView): school_schedules_dict[0] = school_schedules_dict.get(7) for ll in prev_live_lessons: ll.school_schedule = school_schedules_dict.get(ll.date.isoweekday()) - else: - prev_live_lessons = [] context.update({ 'online': online,