|
|
|
|
@ -198,11 +198,28 @@ class SummerSchoolView(TemplateView): |
|
|
|
|
date_end__gte=date_now |
|
|
|
|
) |
|
|
|
|
school_payment_exists = school_payment.exists() |
|
|
|
|
|
|
|
|
|
school_payment_future = SchoolPayment.objects.filter( |
|
|
|
|
user=self.request.user, |
|
|
|
|
status__in=[ |
|
|
|
|
Pingback.PINGBACK_TYPE_REGULAR, |
|
|
|
|
Pingback.PINGBACK_TYPE_GOODWILL, |
|
|
|
|
Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED, |
|
|
|
|
], |
|
|
|
|
date_start__gte=date_now, |
|
|
|
|
date_end__gte=date_now |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
school_payment_exists_future = school_payment_future.exists() |
|
|
|
|
school_purchased_future = school_payment_future.last() |
|
|
|
|
|
|
|
|
|
school_schedules_purchased = school_payment.annotate( |
|
|
|
|
joined_weekdays=Func(F('weekdays'), function='unnest',) |
|
|
|
|
).values_list('joined_weekdays', flat=True).distinct() |
|
|
|
|
else: |
|
|
|
|
school_payment_exists = False |
|
|
|
|
school_payment_exists_future = False |
|
|
|
|
school_purchased_future = False |
|
|
|
|
school_schedules_purchased = [] |
|
|
|
|
if school_payment_exists and is_previous: |
|
|
|
|
live_lessons = LiveLesson.objects.filter( |
|
|
|
|
@ -221,9 +238,11 @@ class SummerSchoolView(TemplateView): |
|
|
|
|
'is_previous': is_previous, |
|
|
|
|
'course_items': Course.objects.filter(status=Course.PUBLISHED)[:6], |
|
|
|
|
'is_purchased': school_payment_exists, |
|
|
|
|
'is_purchased_future': school_payment_exists_future, |
|
|
|
|
'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'], |
|
|
|
|
'school_schedules': SchoolSchedule.objects.all(), |
|
|
|
|
'school_schedules_purchased': school_schedules_purchased, |
|
|
|
|
'school_purchased_future': school_purchased_future, |
|
|
|
|
'subscription_ends': school_payment.filter(add_days=False).first().date_end if school_payment_exists else None, |
|
|
|
|
}) |
|
|
|
|
return context |
|
|
|
|
|