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..f02cf6ed 100644
--- a/project/templates/blocks/promo.html
+++ b/project/templates/blocks/promo.html
@@ -11,22 +11,23 @@
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,14 +36,15 @@
{% if not is_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}
+ >{% if not school_schedule.weekday in school_schedules_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}
{% else %}
diff --git a/project/views.py b/project/views.py
index 73e6877a..c3277a98 100644
--- a/project/views.py
+++ b/project/views.py
@@ -1,6 +1,6 @@
from datetime import datetime, timedelta
-from django.db.models import Min
+from django.db.models import Min, Func, F
from django.contrib.auth import get_user_model
from django.views.generic import TemplateView
from django.utils.timezone import now
@@ -38,12 +38,10 @@ class IndexView(TemplateView):
)
online_coming_soon = (
school_schedule.start_at > 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,