From 9baa23b5a154113b0f0da754115dd9583c46a5bb Mon Sep 17 00:00:00 2001 From: gzbender Date: Tue, 12 Feb 2019 12:40:49 +0500 Subject: [PATCH 1/3] =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BA=D1=83=D1=80=D1=81=D0=B0=20(https://sentry.lil.school/lil?= =?UTF-8?q?/backend/issues/76/)=20=D0=B8=20=D0=BE=D0=BF=D0=BB=D0=B0=D1=82?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/serializers/mixins.py | 2 ++ apps/payment/models.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/v1/serializers/mixins.py b/api/v1/serializers/mixins.py index a79ff8e5..451b362a 100644 --- a/api/v1/serializers/mixins.py +++ b/api/v1/serializers/mixins.py @@ -145,6 +145,8 @@ class DispatchGalleryMixin(object): ) if 'images' in gallery: for image in gallery['images']: + if not image.get('img'): + continue if isinstance(image['img'], ImageObject): img = image['img'] else: diff --git a/apps/payment/models.py b/apps/payment/models.py index 63664693..a11439c4 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -229,8 +229,8 @@ class Payment(PolymorphicModel): def save(self, *args, **kwargs): if not self.is_paid(): + amount_data = Payment.calc_amount(payment=self) if not self.bonus: - amount_data = Payment.calc_amount(payment=self) self.amount = amount_data.get('amount') if isinstance(self, SchoolPayment): self.weekdays = amount_data.get('weekdays') From 86bfcf9daca828706a9a88d56a481bb099cc3daa Mon Sep 17 00:00:00 2001 From: gzbender Date: Tue, 12 Feb 2019 12:42:00 +0500 Subject: [PATCH 2/3] =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BA=D1=83=D1=80=D1=81=D0=B0=20(https://sentry.lil.school/lil?= =?UTF-8?q?/backend/issues/76/)=20=D0=B8=20=D0=BE=D0=BF=D0=BB=D0=B0=D1=82?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/payment/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/payment/models.py b/apps/payment/models.py index a11439c4..4e157d4a 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -228,8 +228,8 @@ class Payment(PolymorphicModel): ] def save(self, *args, **kwargs): + amount_data = Payment.calc_amount(payment=self) if not self.is_paid(): - amount_data = Payment.calc_amount(payment=self) if not self.bonus: self.amount = amount_data.get('amount') if isinstance(self, SchoolPayment): From 25cd507306a1aa21526c52d3c33e7657df25938e Mon Sep 17 00:00:00 2001 From: gzbender Date: Tue, 12 Feb 2019 13:20:10 +0500 Subject: [PATCH 3/3] =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BA=D1=83=D1=80=D1=81=D0=B0=20(https://sentry.lil.school/lil?= =?UTF-8?q?/backend/issues/76/)=20=D0=B8=20=D0=BE=D0=BF=D0=BB=D0=B0=D1=82?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/school/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/school/views.py b/apps/school/views.py index 7387c129..3dc0f01a 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -187,7 +187,7 @@ class SchoolView(TemplateView): date__range=date_range, deactivated_at__isnull=True, date__week_day__in=list(map(lambda x: 1 if x == 7 else x+1, sp.weekdays)), - ).values_list('id', flat=True)) + ).exclude(title='').values_list('id', flat=True)) prev_live_lessons = LiveLesson.objects.filter(id__in=set(prev_live_lessons)).order_by('-date') prev_live_lessons_exists = prev_live_lessons.exists() if prev_live_lessons_exists: @@ -195,7 +195,6 @@ class SchoolView(TemplateView): school_schedules_dict[0] = school_schedules_dict.get(7) for ll in prev_live_lessons: ll.school_schedule = school_schedules_dict.get(ll.date.isoweekday()) - context.update({ 'online': online, 'prev_live_lessons': prev_live_lessons,