не начисляются бонусы за вторую покуппку

remotes/origin/hotfix/paid-more-bonuses-1-07-19
gzbender 7 years ago
parent 2409b29f9a
commit ecda8f8eb6
  1. 9
      apps/user/models.py

@ -151,11 +151,12 @@ class User(AbstractUser):
@property
def paid_one_more(self):
from apps.payment.models import SchoolPayment, CoursePayment, Payment
school_payments_cnt = SchoolPayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self,
from apps.payment.models import SchoolPayment, CoursePayment, Payment, DrawingCampPayment
payments_cnt = SchoolPayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self,
add_days=False).count()
course_payment_cnt = CoursePayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self).count()
return school_payments_cnt > 1 or course_payment_cnt > 1 or (school_payments_cnt and course_payment_cnt)
payments_cnt += CoursePayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self).count()
payments_cnt += DrawingCampPayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self).count()
return payments_cnt > 1
@receiver(post_save, sender=User)

Loading…
Cancel
Save