|
|
|
|
@ -135,6 +135,7 @@ class SchoolView(TemplateView): |
|
|
|
|
school_schedules_dict[0] = school_schedules_dict.get(7) |
|
|
|
|
live_lessons = None |
|
|
|
|
live_lessons_exists = False |
|
|
|
|
subscription_ends = None |
|
|
|
|
if self.request.user.is_authenticated: |
|
|
|
|
school_payment = SchoolPayment.objects.filter( |
|
|
|
|
user=self.request.user, |
|
|
|
|
@ -149,7 +150,13 @@ class SchoolView(TemplateView): |
|
|
|
|
status__in=SchoolPayment.PW_PAID_STATUSES, |
|
|
|
|
date_start__gt=date_now, |
|
|
|
|
date_end__gt=date_now |
|
|
|
|
).exists() |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
if school_purchased_future.exists(): |
|
|
|
|
subscription_ends = school_purchased_future.filter(add_days=False).latest( |
|
|
|
|
'date_end').date_end |
|
|
|
|
elif school_payment_exists: |
|
|
|
|
subscription_ends = school_payment.filter(add_days=False).latest('date_end').date_end |
|
|
|
|
|
|
|
|
|
school_schedules_purchased = school_payment.annotate( |
|
|
|
|
joined_weekdays=Func(F('weekdays'), function='unnest',) |
|
|
|
|
@ -184,7 +191,7 @@ class SchoolView(TemplateView): |
|
|
|
|
ll.school_schedule = school_schedules_dict.get(ll.date.isoweekday()) |
|
|
|
|
live_lessons_exists = live_lessons.exists() |
|
|
|
|
live_lessons = live_lessons or None |
|
|
|
|
subscription_ends = school_payment.filter(add_days=False).latest('date_end').date_end if school_payment_exists else None |
|
|
|
|
|
|
|
|
|
context.update({ |
|
|
|
|
'online': online, |
|
|
|
|
'live_lessons': live_lessons, |
|
|
|
|
|