Fix waiting list availability calculation if WL vouchers have seats (Z#23226856)

This commit is contained in:
Kara Engelhardt
2026-03-09 13:37:08 +01:00
committed by pajowu
parent 99e9690d48
commit f3fb1e66dc
3 changed files with 81 additions and 7 deletions

View File

@@ -280,11 +280,12 @@ class WaitingListView(EventPermissionRequiredMixin, WaitingListQuerySetMixin, Pa
block_quota=True,
item_id=wle.item_id,
subevent=wle.subevent_id,
waitinglistentries__isnull=False
waitinglistentries__isnull=False,
seat__isnull=True
).aggregate(free=Sum(F('max_usages') - F('redeemed')))['free'] or 0
free_seats = num_free_seats_for_product - num_valid_vouchers_for_product
wle.availability = (
Quota.AVAILABILITY_GONE if free_seats == 0 else wle.availability[0],
Quota.AVAILABILITY_GONE if free_seats < 1 else wle.availability[0],
min(free_seats, wle.availability[1]) if wle.availability[1] is not None else free_seats,
)