|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
|
from time import time |
|
|
|
|
import decimal |
|
|
|
|
from datetime import datetime, timedelta |
|
|
|
|
from itertools import chain |
|
|
|
|
|
|
|
|
|
from django.db.models import Min |
|
|
|
|
from django.contrib.auth import get_user_model |
|
|
|
|
@ -32,7 +31,6 @@ class IndexView(TemplateView): |
|
|
|
|
online_coming_soon = False |
|
|
|
|
school_schedule = None |
|
|
|
|
else: |
|
|
|
|
end_at = datetime.combine(now_time.today(), school_schedule.start_at) |
|
|
|
|
online = school_schedule.is_online() |
|
|
|
|
online_coming_soon = school_schedule.online_coming_soon() |
|
|
|
|
|
|
|
|
|
@ -40,15 +38,12 @@ class IndexView(TemplateView): |
|
|
|
|
if self.request.user.is_authenticated: |
|
|
|
|
schoolpayment_queryset = self.request.user.school_payments() |
|
|
|
|
school_payment_exists = schoolpayment_queryset.exists() |
|
|
|
|
school_schedules_purchased = schoolpayment_queryset.values_list('weekdays', flat=True) |
|
|
|
|
school_schedules_purchased = school_schedules_purchased[0] if school_schedules_purchased else [] |
|
|
|
|
|
|
|
|
|
school_payment_future = SchoolPayment.objects.filter( |
|
|
|
|
user=self.request.user, |
|
|
|
|
date_start__gte=date_now, |
|
|
|
|
date_end__gte=date_now |
|
|
|
|
school_schedules_purchased = list( |
|
|
|
|
chain.from_iterable( |
|
|
|
|
schoolpayment_queryset.values_list('weekdays', flat=True) |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
school_payment_future = self.request.user.school_payments() |
|
|
|
|
school_payment_exists_future = school_payment_future.exists() |
|
|
|
|
school_purchased_future = school_payment_future.last() |
|
|
|
|
|
|
|
|
|
|