Merge branch 'hotfix/LIL-649' into 'master'

Hotfix/lil 649

See merge request lilcity/backend!136
remotes/origin/hotfix/LIL-661
cfwme 7 years ago
commit 3779e7b759
  1. 6
      apps/school/templates/blocks/schedule_item.html
  2. 2
      apps/user/views.py
  3. 14
      project/templates/blocks/promo.html
  4. 13
      project/views.py

@ -6,12 +6,12 @@
{{ school_schedule }}
</div>
{% if is_purchased and live_lesson %}
<div class="timing__date">{{ live_lesson.date }}</div>
<div class="timing__date">{{ live_lesson.date|date:"j E" }}</div>
{% endif %}
<div class="timing__time">{{ school_schedule.start_at }} (МСК)</div>
<div class="timing__buy">
{% 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 %}

@ -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,

@ -11,22 +11,23 @@
<div class="main__title">
<span class="main__bold">Lil School</span> — первая образовательная онлайн-платформа креативного мышления для детей
</div>
{% if False and user.is_authenticated and online %}
{% if user.is_authenticated and online %}
<div class="main__content">
Сейчас идёт прямой эфир урока «{{ school_schedule.title }}, {{ school_schedule.current_live_lesson.title }}»
</div>
<div class="main__actions">
<a
{% if not is_purchased %}
{% if not school_schedule.weekday in school_schedules_purchased %}
data-popup=".js-popup-buy"
data-day="{{ school_schedule.weekday }}"
href='#'
{% else %}
href="{{ school_schedule.current_live_lesson.get_absolute_url }}"
{% endif %}
class="main__btn btn"
>{% if not is_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
>{% if not school_schedule.weekday in school_schedules_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
</div>
{% 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 %}
<div class="">
Урок «{{ school_schedule.title }}, {{ school_schedule.current_live_lesson.title }}» начнётся
</div>
@ -35,14 +36,15 @@
</div>
<div class="main__actions">
<a
{% if not is_purchased %}
{% if not school_schedule.weekday in school_schedules_purchased %}
data-popup=".js-popup-buy"
data-day="{{ school_schedule.weekday }}"
href='#'
{% else %}
href="{{ school_schedule.current_live_lesson.get_absolute_url }}"
{% endif %}
class="main__btn btn"
>{% if not is_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
>{% if not school_schedule.weekday in school_schedules_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
</div>
{% else %}
<div class="main__subtitle">

@ -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,

Loading…
Cancel
Save