Created
April 13, 2015 18:28
-
-
Save edvm/f1f90a9e7218db6cd5bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (coupon.group.ctype == SINGLE_USE_ONE_MEMBER_ONLY | |
| and CouponStatus.objects.filter(coupon=coupon).exists()): | |
| log("Member %s tried to redeem a single-use single-member coupon, failed: %s" % ( | |
| member.pk, code, | |
| )) | |
| return (False, u'Only one promo code may be redeemed per transaction') | |
| elif coupon.group.ctype == ONCE_PER_MEMBER_MAX_USES: | |
| if 0 < coupon.max_users <= CouponStatus.objects.filter(coupon=coupon).count(): | |
| log("Member %s tried to redeem a once-per-member max user coupon that " | |
| "was maxed out, failed: %s" % (member.pk, code)) | |
| return (False, u'Code has already been redeemed!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment