diff --git a/apps/school/views.py b/apps/school/views.py index 71029683..b58869b5 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -137,7 +137,7 @@ class SchoolView(TemplateView): school_schedules_purchased = [] school_purchased_future = False prev_school_payments = None - prev_range = [date_now - timedelta(days=8), date_now] + prev_range = [date_now - timedelta(days=8), date_now - timedelta(days=1)] if self.request.user.is_authenticated: school_payment = SchoolPayment.objects.filter( user=self.request.user, @@ -165,7 +165,7 @@ class SchoolView(TemplateView): ).values_list('joined_weekdays', flat=True).distinct() prev_school_payments = SchoolPayment.objects.filter( - date_start__lt=prev_range[1], + date_start__lte=prev_range[1], date_end__gte=prev_range[0], user=self.request.user, status__in=[ @@ -180,11 +180,11 @@ 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( + 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, diff --git a/project/templates/lilcity/edit_index.html b/project/templates/lilcity/edit_index.html index 70691489..a88a7e84 100644 --- a/project/templates/lilcity/edit_index.html +++ b/project/templates/lilcity/edit_index.html @@ -321,7 +321,7 @@ var schoolAmountForDiscount = parseFloat({{ config.SERVICE_DISCOUNT_MIN_AMOUNT }}); {% block foot %}{% endblock foot %} - + diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index 48c85a01..ada31a74 100644 --- a/project/templates/lilcity/index.html +++ b/project/templates/lilcity/index.html @@ -155,7 +155,7 @@ {% include 'templates/blocks/lil_store_js.html' %} {% block pre_app_js %}{% endblock pre_app_js %} - +