mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Resolved two more edge cases in quota handling
Scenario 1) Blocking voucher is used in a CartPosition. Previously too much was subtracted from the quota. Scenario 2) When two quotas are assigned to a product and one of them is sold out, blocking vouchers for the other quota should not enable to buy the product.
This commit is contained in:
@@ -554,6 +554,10 @@ class Quota(LoggedModel):
|
||||
|
||||
return CartPosition.objects.filter(
|
||||
Q(expires__gte=now()) &
|
||||
~Q(
|
||||
Q(voucher__isnull=False) & Q(voucher__block_quota=True)
|
||||
& Q(Q(voucher__valid_until__isnull=True) | Q(voucher__valid_until__gte=now()))
|
||||
) &
|
||||
self._position_lookup
|
||||
).distinct().count()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user