diff --git a/apps/school/templates/blocks/schedule_purchased.html b/apps/school/templates/blocks/schedule_purchased.html index e70ca248..03e98e92 100644 --- a/apps/school/templates/blocks/schedule_purchased.html +++ b/apps/school/templates/blocks/schedule_purchased.html @@ -19,6 +19,7 @@
+ {% if not profile %}
{% if is_previous %}
Запись уроков
@@ -32,6 +33,7 @@
+ {% endif %}
{% if is_previous and not live_lessons_exists %} diff --git a/apps/user/templates/user/profile.html b/apps/user/templates/user/profile.html index c1bb7f81..3f5203b6 100644 --- a/apps/user/templates/user/profile.html +++ b/apps/user/templates/user/profile.html @@ -63,6 +63,7 @@
+ @@ -71,9 +72,11 @@ КУРСЫ {% endif %} -
+
+ {% include "blocks/schedule_purchased.html" %} +
@@ -90,13 +93,6 @@
{% endif %} -
-
-
- {% include "course/school.html" %} -
-
-
diff --git a/apps/user/views.py b/apps/user/views.py index a771152e..8bdc6824 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -77,12 +77,18 @@ class UserView(DetailView): school_schedules_purchased = school_payment.annotate( joined_weekdays=Func(F('weekdays'), function='unnest',) ).values_list('joined_weekdays', flat=True).distinct() + context['school_schedules_purchased'] = school_schedules_purchased context['school_payment'] = school_payment + context['is_purchased'] = school_payment.exists() + context['profile'] = True if school_payment.exists() and school_payment.last().date_end: - context['school_days_left'] = (school_payment.last().date_end - now().date()).days + context['subscription_ends'] = school_payment.last().date_end context['school_schedules'] = SchoolSchedule.objects.filter( weekday__in=school_schedules_purchased if school_payment.exists() else [], - ) + ).annotate( + calk=F('weekday') - now().isoweekday(), + weight=(7 + F('calk') % 7) % 7, + ).order_by('weight') return context