Merge branch 'hotfix/save_course_and_payment_fix_12-02-19' into 'master'

Hotfix/save course and payment fix 12 02 19

See merge request lilschool/site!268
remotes/origin/feature/course_access_duration_7-02-19
Danil 7 years ago
commit 53723492cd
  1. 2
      api/v1/serializers/mixins.py
  2. 2
      apps/payment/models.py
  3. 3
      apps/school/views.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:

@ -228,9 +228,9 @@ class Payment(PolymorphicModel):
]
def save(self, *args, **kwargs):
amount_data = Payment.calc_amount(payment=self)
if not self.is_paid():
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')

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

Loading…
Cancel
Save