From 73be6abf295528223749f3cfa49913e18b5f27bb Mon Sep 17 00:00:00 2001 From: gzbender Date: Sat, 1 Sep 2018 03:16:00 +0500 Subject: [PATCH] =?UTF-8?q?LIL-649=20=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0/=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=8B=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/school/templates/blocks/schedule_item.html | 6 +++--- apps/user/views.py | 2 +- project/templates/blocks/promo.html | 10 +++++----- project/views.py | 13 ++++++------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/apps/school/templates/blocks/schedule_item.html b/apps/school/templates/blocks/schedule_item.html index 931c6829..63dde442 100644 --- a/apps/school/templates/blocks/schedule_item.html +++ b/apps/school/templates/blocks/schedule_item.html @@ -6,12 +6,12 @@ {{ school_schedule }} {% if is_purchased and live_lesson %} -
{{ live_lesson.date }}
+
{{ live_lesson.date|date:"j E" }}
{% endif %}
{{ school_schedule.start_at }} (МСК)
- {% if is_purchased %} - {% if school_schedule.weekday in school_schedules_purchased and live_lesson and live_lesson.title %} + {% if is_purchased and school_schedule.weekday in school_schedules_purchased %} + {% if live_lesson and live_lesson.title %} {% include './open_lesson.html' %} {% endif %} {% else %} diff --git a/apps/user/views.py b/apps/user/views.py index a14daef6..4f2d424e 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -73,7 +73,7 @@ class ProfileView(TemplateView): school_payment = SchoolPayment.objects.filter( user=self.object, date_start__lte=now(), - date_end__gt=now(), + date_end__gte=now(), status__in=[ Pingback.PINGBACK_TYPE_REGULAR, Pingback.PINGBACK_TYPE_GOODWILL, diff --git a/project/templates/blocks/promo.html b/project/templates/blocks/promo.html index f6f49349..58b06c89 100644 --- a/project/templates/blocks/promo.html +++ b/project/templates/blocks/promo.html @@ -11,22 +11,22 @@
Lil School — первая образовательная онлайн-платформа креативного мышления для детей
- {% if False and user.is_authenticated and online %} + {% if user.is_authenticated and online %}
Сейчас идёт прямой эфир урока «{{ school_schedule.title }}, {{ school_schedule.current_live_lesson.title }}»
{% if not is_purchased %}Получить доступ{% else %}Смотреть урок{% endif %} + >{% if not school_schedule.weekday in school_schedules_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}
- {% elif False and user.is_authenticated and online_coming_soon and school_schedule and school_schedule.start_at_humanize %} + {% elif user.is_authenticated and online_coming_soon and school_schedule and school_schedule.start_at_humanize %}
Урок «{{ school_schedule.title }}, {{ school_schedule.current_live_lesson.title }}» начнётся
@@ -35,7 +35,7 @@
now_time.time() and - ( - datetime.combine(datetime.today(), school_schedule.start_at) - timedelta(hours=12) - ).time() <= now_time.time() and + datetime.combine(datetime.today(), school_schedule.start_at) - timedelta(hours=12) + <= datetime.combine(datetime.today(), now_time.time()) and school_schedule.current_live_lesson ) - date_now = now_time.date() if self.request.user.is_authenticated: school_payment = SchoolPayment.objects.filter( @@ -52,8 +50,9 @@ class IndexView(TemplateView): date_end__gte=date_now ) school_payment_exists = school_payment.exists() - school_schedules_purchased = school_payment.values_list('weekdays', flat=True) - school_schedules_purchased = school_schedules_purchased[0] if school_schedules_purchased else [] + school_schedules_purchased = school_payment.annotate( + joined_weekdays=Func(F('weekdays'), function='unnest',) + ).values_list('joined_weekdays', flat=True).distinct() school_payment_future = SchoolPayment.objects.filter( user=self.request.user,