diff --git a/finance/views.py b/finance/views.py index 357ed78..e9566a1 100644 --- a/finance/views.py +++ b/finance/views.py @@ -203,19 +203,21 @@ class InvoiceDetailView(APIView): if pay_count > 1: invoice.create_child_pays(pay_count) - if invoice.method == 'Y' and invoice.yandex_pay is None: - yandex_pay = Payment( - order_amount=invoice.price, - shop_amount=0, - customer_number=bill.user.id, - user=bill.user, - cps_email=bill.user.email, - ) - if pay_count > 1: - yandex_pay.shop_id = settings.YANDEX_MONEY_REBILLING_SHOP_ID - yandex_pay.scid = settings.YANDEX_MONEY_REBILLING_SCID - yandex_pay.save() - invoice.yandex_pay = yandex_pay + if invoice.method == 'Y' and invoice.status == 'P': + if invoice.yandex_pay is None: + yandex_pay = Payment( + order_amount=invoice.price, + shop_amount=0, + customer_number=bill.user.id, + user=bill.user, + cps_email=bill.user.email, + ) + if pay_count > 1: + yandex_pay.shop_id = settings.YANDEX_MONEY_REBILLING_SHOP_ID + yandex_pay.scid = settings.YANDEX_MONEY_REBILLING_SCID + yandex_pay.save() + invoice.yandex_pay = yandex_pay + invoice.send_link() context = { diff --git a/progress/views.py b/progress/views.py index eb1f45a..43705f4 100644 --- a/progress/views.py +++ b/progress/views.py @@ -68,7 +68,7 @@ class CourseProgressDynamicView(APIView): @staticmethod def get(request): course_token = request.GET.get('course_token', '') - teacher_email = request.GET.get('teacher_email', '') + teacher_email = request.GET.get('teacher_email', '').lower() from_date = int(request.GET.get('from', '7')) to_date = int(request.GET.get('to', '0')) only_hw = request.GET.get('only_hw', 'yes') == 'yes' @@ -82,7 +82,7 @@ class CourseProgressDynamicView(APIView): if not course_token is '': progresses = progresses.filter(progress__course_token=course_token) - if not (teacher_email is '' or only_hw): + if not teacher_email is '': progresses = progresses.filter(checker__email=teacher_email) res = {}