From bd2da70c3bdb98f15fcbb48ec634eb8511cd26b2 Mon Sep 17 00:00:00 2001 From: gzbender Date: Sat, 21 Jul 2018 01:05:09 +0500 Subject: [PATCH 1/7] =?UTF-8?q?LIL-580=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B5=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5=20=D1=83=D1=80?= =?UTF-8?q?=D0=BE=D0=BA=D0=B0=20=D1=88=D0=BA=D0=BE=D0=BB=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/course/templates/course/lesson.html | 19 +++++++++++++++++ .../templates/school/livelesson_detail.html | 21 +++++++++++++++++++ web/src/sass/_common.sass | 2 ++ 3 files changed, 42 insertions(+) diff --git a/apps/course/templates/course/lesson.html b/apps/course/templates/course/lesson.html index 662a4dd5..dd3c178d 100644 --- a/apps/course/templates/course/lesson.html +++ b/apps/course/templates/course/lesson.html @@ -29,6 +29,25 @@
{{ lesson.title }}
{{ lesson.short_description }}
+ +
+ {% if lesson.author.photo %} +
+ +
+ {% else %} +
+ +
+ {% endif %} +
+
{{ lesson.author.get_full_name }}
+
+
{{ lesson.created_at_humanize }}
+
+
+
+
{% comment %} {% if lesson.cover %} diff --git a/apps/school/templates/school/livelesson_detail.html b/apps/school/templates/school/livelesson_detail.html index 1bcb3227..2637da2c 100644 --- a/apps/school/templates/school/livelesson_detail.html +++ b/apps/school/templates/school/livelesson_detail.html @@ -8,6 +8,27 @@
{{ livelesson.title }}
{{ livelesson.short_description }}
+ {% comment %} +
+
+ {% if livelesson.author.photo %} +
+ +
+ {% else %} +
+ +
+ {% endif %} +
+
{{ livelesson.author.get_full_name }}
+
+
{{ livelesson.created_at_humanize }}
+
+
+
+
+ {% endcomment %} {% if livelesson.stream_index %} - Если видео не загрузилось обновите страницу + Если видео не загрузилось - уменьшите качество видео или обновите страницу {% else %} {% if livelesson.cover %} @@ -22,7 +22,7 @@ {% endif %} {% endif %} - +
From 74dec82c1f4c535577f143cda601d69512b0cf22 Mon Sep 17 00:00:00 2001 From: gzbender Date: Sun, 29 Jul 2018 06:22:59 +0500 Subject: [PATCH 5/7] =?UTF-8?q?LIL-593=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=B0=D1=82=D1=8C=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA?= =?UTF-8?q?=D1=83=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D0=BF=D0=BB?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=B6=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/api/v1/views.py b/api/v1/views.py index 41cd881a..bb5eb6ed 100644 --- a/api/v1/views.py +++ b/api/v1/views.py @@ -419,13 +419,24 @@ class AuthorRequestViewSet(ExtendedModelViewSet): class PaymentViewSet(ExtendedModelViewSet): - queryset = Payment.objects.filter(status__isnull=False).order_by('-created_at') + queryset = Payment.objects.all() serializer_class = PaymentSerializer permission_classes = (IsAdmin,) - filter_fields = ('status',) + filter_fields = ('status', 'user',) ordering_fields = ( 'id', 'user__email', 'user__first_name', 'user__last_name', 'amount', 'created_at', ) search_fields = ('user__email', 'user__first_name', 'user__last_name',) + + def get_queryset(self): + queryset = self.queryset + course = self.request.query_params.get('course') + weekdays = self.request.query_params.getlist('weekdays[]') + if course: + queryset = CoursePayment.objects.filter(course=course) + if weekdays: + queryset = SchoolPayment.objects.filter(weekdays__overlap=weekdays) + + return queryset.filter(status__isnull=False).order_by('-created_at') From 1d1f516f0e25d3edb449584c4c057a70b7a5462c Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 10 Aug 2018 23:56:09 +0300 Subject: [PATCH 6/7] category fix --- apps/course/templates/course/_items.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html index 42757ddc..b4356f2b 100644 --- a/apps/course/templates/course/_items.html +++ b/apps/course/templates/course/_items.html @@ -48,7 +48,7 @@
{{ course.category | upper }} + href="{% url 'courses' %}?category={{ course.category.id }}">{{ course.category | upper }} {% if not course.is_free %}
{{ course.price|floatformat:"-2" }}₽
{% endif %} From 1258a695c8f8c3d36ec47b020d21f6d0fc0e7425 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Thu, 19 Jul 2018 15:12:14 +0300 Subject: [PATCH 7/7] LIL-575. Effective amount from payment provider (cherry picked from commit 5393d61) --- apps/payment/models.py | 2 +- apps/payment/views.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/payment/models.py b/apps/payment/models.py index 415ad98e..25e98c82 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -190,7 +190,7 @@ class SchoolPayment(Payment): month_price_sum = aggregate.get('month_price__sum', 0) * weekday_count // all_weekday_count else: month_price_sum = aggregate.get('month_price__sum', 0) - if month_price_sum >= config.SERVICE_DISCOUNT_MIN_AMOUNT: + if self.id is None and month_price_sum >= config.SERVICE_DISCOUNT_MIN_AMOUNT: discount = config.SERVICE_DISCOUNT else: discount = 0 diff --git a/apps/payment/views.py b/apps/payment/views.py index 40fccca0..afe2b8ac 100644 --- a/apps/payment/views.py +++ b/apps/payment/views.py @@ -197,12 +197,18 @@ class PaymentwallCallbackView(View): payment.status = pingback.get_type() payment.data = payment_raw_data if pingback.is_deliverable(): + effective_amount = pingback.get_parameter('effective_price_amount') + + if effective_amount: + payment.amount = effective_amount + transaction_to_mixpanel.delay( payment.user.id, payment.amount, now().strftime('%Y-%m-%dT%H:%M:%S'), product_type_name, ) + if product_type_name == 'school': school_payment = SchoolPayment.objects.filter( user=payment.user, @@ -252,6 +258,7 @@ class PaymentwallCallbackView(View): 'update_at': payment.update_at, } payment.save() + product_payment_to_mixpanel.delay( payment.user.id, f'{product_type_name.title()} payment', @@ -269,6 +276,7 @@ class PaymentwallCallbackView(View): product_type_name, payment.roistat_visit, ) + author_balance = getattr(payment, 'author_balance', None) if author_balance and author_balance.type == AuthorBalance.IN: if pingback.is_deliverable(): @@ -277,7 +285,6 @@ class PaymentwallCallbackView(View): payment.author_balance.status = AuthorBalance.PENDING else: payment.author_balance.status = AuthorBalance.DECLINED - payment.author_balance.save() return HttpResponse('OK') else: