diff --git a/api/v1/views.py b/api/v1/views.py index 7620244b..d5dae90d 100644 --- a/api/v1/views.py +++ b/api/v1/views.py @@ -72,7 +72,7 @@ User = get_user_model() class AuthorBalanceViewSet(ExtendedModelViewSet): queryset = AuthorBalance.objects.filter( - author__role__in=[User.AUTHOR_ROLE, User.ADMIN_ROLE], + author__role__in=[User.AUTHOR_ROLE, User.ADMIN_ROLE, User.TEACHER_ROLE], ) serializer_class = AuthorBalanceCreateSerializer serializer_class_map = { diff --git a/apps/payment/models.py b/apps/payment/models.py index 69eaf54c..a0fa11d3 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -205,13 +205,14 @@ class Payment(PolymorphicModel): ] def save(self, *args, **kwargs): + paid = self.status in [Pingback.PINGBACK_TYPE_REGULAR, Pingback.PINGBACK_TYPE_GOODWILL, + Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED,] amount_data = Payment.calc_amount(payment=self) - self.amount = amount_data.get('amount') + if self.status is None: + self.amount = amount_data.get('amount') if isinstance(self, SchoolPayment): self.weekdays = amount_data.get('weekdays') super().save(*args, **kwargs) - paid = self.status in [Pingback.PINGBACK_TYPE_REGULAR, Pingback.PINGBACK_TYPE_GOODWILL, - Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED,] if isinstance(self, CoursePayment): author_balance = getattr(self, 'authorbalance', None) if not author_balance and paid: @@ -240,7 +241,6 @@ class CoursePayment(Payment): verbose_name_plural = 'Платежи за курсы' - class SchoolPayment(Payment): weekdays = ArrayField(models.IntegerField(), size=7, verbose_name='Дни недели') add_days = models.BooleanField('Докупленные дни', default=False) diff --git a/apps/payment/views.py b/apps/payment/views.py index abca9736..2f2f3df0 100644 --- a/apps/payment/views.py +++ b/apps/payment/views.py @@ -1,3 +1,5 @@ +from decimal import Decimal + import arrow import json import logging @@ -213,7 +215,7 @@ class PaymentwallCallbackView(View): effective_amount = payment_raw_data.get('effective_price_amount') if effective_amount: - payment.amount = effective_amount + payment.amount = Decimal(effective_amount) transaction_to_mixpanel.delay( payment.user.id, diff --git a/apps/school/templates/blocks/open_lesson.html b/apps/school/templates/blocks/open_lesson.html index abb8a9a2..46999c7f 100644 --- a/apps/school/templates/blocks/open_lesson.html +++ b/apps/school/templates/blocks/open_lesson.html @@ -1,4 +1,4 @@ подробнее +>смотреть урок diff --git a/apps/school/templates/school/summer_school.html b/apps/school/templates/school/summer_school.html index 00da0bf8..0f0c1fe4 100644 --- a/apps/school/templates/school/summer_school.html +++ b/apps/school/templates/school/summer_school.html @@ -1,6 +1,6 @@ {% extends "templates/lilcity/index.html" %} {% load static %} {% block title %}Онлайн-школа LilCity{% endblock title%} -{% block ogimage %}http://{{request.META.HTTP_HOST}}{% static 'img/og_summer_school.jpg' %}{% endblock %} +{% block ogimage %}http://{{request.META.HTTP_HOST}}{% static 'img/og_main.jpg' %}{% endblock %} {% block content %} {% if not is_purchased %} {% include "../summer/promo.html" %}