Waiting list: Correct status in backend

This commit is contained in:
Raphael Michel
2021-01-07 10:29:22 +01:00
parent ecf05b2392
commit 9056826b68

View File

@@ -160,15 +160,24 @@ class WaitingListView(EventPermissionRequiredMixin, PaginationMixin, ListView):
quota_cache = {} quota_cache = {}
any_avail = False any_avail = False
for wle in ctx[self.context_object_name]: for wle in ctx[self.context_object_name]:
if (wle.item, wle.variation) in itemvar_cache: if (wle.item, wle.variation, wle.subevent) in itemvar_cache:
wle.availability = itemvar_cache.get((wle.item, wle.variation)) wle.availability = itemvar_cache.get((wle.item, wle.variation, wle.subevent))
else: else:
wle.availability = ( ev = (wle.subevent or self.request.event)
wle.variation.check_quotas(count_waitinglist=False, subevent=wle.subevent, _cache=quota_cache) disabled = (
if wle.variation not ev.presale_is_running or
else wle.item.check_quotas(count_waitinglist=False, subevent=wle.subevent, _cache=quota_cache) (wle.subevent and not wle.subevent.active) or
not wle.item.is_available()
) )
itemvar_cache[(wle.item, wle.variation)] = wle.availability if disabled:
wle.availability = (0, "forbidden")
else:
wle.availability = (
wle.variation.check_quotas(count_waitinglist=False, subevent=wle.subevent, _cache=quota_cache)
if wle.variation
else wle.item.check_quotas(count_waitinglist=False, subevent=wle.subevent, _cache=quota_cache)
)
itemvar_cache[(wle.item, wle.variation, wle.subevent)] = wle.availability
if wle.availability[0] == 100: if wle.availability[0] == 100:
any_avail = True any_avail = True