diff --git a/apps/school/models.py b/apps/school/models.py index eaa17664..f1dcc168 100644 --- a/apps/school/models.py +++ b/apps/school/models.py @@ -68,7 +68,7 @@ class SchoolSchedule(models.Model): @property def start_at_humanize(self): - return arrow.get(self.start_at).humanize(locale='ru') if self.start_at else None + return arrow.get(datetime.combine(datetime.today(), self.start_at)).humanize(locale='ru') if self.start_at else None class SchoolScheduleImage(models.Model): diff --git a/project/views.py b/project/views.py index 2f6b62b1..ea165c91 100644 --- a/project/views.py +++ b/project/views.py @@ -37,8 +37,10 @@ class IndexView(TemplateView): school_schedule.current_live_lesson() ) online_coming_soon = ( - school_schedule.start_at < now_time.time() and - (school_schedule.start_at - timedelta(hours=5)).time() >= now_time.time() and + school_schedule.start_at > now_time.time() and + ( + datetime.combine(datetime.today(), school_schedule.start_at) - timedelta(hours=5) + ).time() <= now_time.time() and school_schedule.current_live_lesson() ) @@ -71,6 +73,7 @@ class IndexView(TemplateView): context.update({ 'online': online, 'online_coming_soon': online_coming_soon, + 'school_schedule': school_schedule, 'course_items': Course.objects.filter(status=Course.PUBLISHED)[:6], 'is_purchased': school_payment_exists, 'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'],