From 8fe837d5d43b533b2b5aedc4e36d53200494e9e2 Mon Sep 17 00:00:00 2001 From: Khai Tran Date: Wed, 28 Feb 2024 12:26:01 +0700 Subject: [PATCH] fix: Fix is first payment --- .../api_orm/repositories/payment_repository.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/locker_server/api_orm/repositories/payment_repository.py b/locker_server/api_orm/repositories/payment_repository.py index c901ddf..073d850 100644 --- a/locker_server/api_orm/repositories/payment_repository.py +++ b/locker_server/api_orm/repositories/payment_repository.py @@ -178,10 +178,12 @@ def is_first_payment(self, user_id: int, **filter_params) -> bool: payments = PaymentORM.objects.filter(user_id=user_id) if exclude_total_0 is True: payments = payments.exclude(total_price=0) - if plans_param: - payments = payments.filter(plan__in=plans_param) - if durations: - payments = payments.filter(duration__in=durations) + if plans_param and durations: + payments = payments.filter(plan__in=plans_param, duration__in=durations) + # if plans_param: + # payments = payments.filter(plan__in=plans_param) + # if durations: + # payments = payments.filter(duration__in=durations) return payments.count() == 1 # ------------------------ Create Payment resource --------------------- #