forked from CGM_Public/pretix_original
Improvements around the waiting list (#2219)
* Waiting list: Support for seated events, pre-fill customer email address * Allow people to remove themselves * Update src/pretix/base/settings.py Co-authored-by: Richard Schreiber <schreiber@rami.io> * Update src/pretix/control/views/waitinglist.py Co-authored-by: Richard Schreiber <schreiber@rami.io> * Update src/pretix/control/views/waitinglist.py Co-authored-by: Richard Schreiber <schreiber@rami.io> * Update src/pretix/control/views/waitinglist.py Co-authored-by: Richard Schreiber <schreiber@rami.io> * Update src/pretix/presale/views/waiting.py Co-authored-by: Richard Schreiber <schreiber@rami.io> * Resolve a review note * Review notes * Fix linter issues * Fix import Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
@@ -256,9 +256,22 @@
|
||||
<div class="alert alert-info">
|
||||
{% blocktrans trimmed %}
|
||||
The waiting list currently is not compatible with some advanced features of pretix such as
|
||||
seating plans, add-on products or product bundles.
|
||||
add-on products or product bundles.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
<div class="alert alert-info">
|
||||
{% blocktrans trimmed %}
|
||||
The waiting list determines availability mainly based on quotas. If you use a seating plan and your
|
||||
number of available seats is less than the available quota, you might run into situations where
|
||||
people are sent an email from the waiting list but still are unable to book a seat.
|
||||
{% endblocktrans %}
|
||||
<strong>
|
||||
{% blocktrans trimmed %}
|
||||
Specifically, this means the waiting list is not safe to use together with the minimum distance
|
||||
feature of our seating plan module.
|
||||
{% endblocktrans %}
|
||||
</strong>
|
||||
</div>
|
||||
{% bootstrap_field sform.waiting_list_enabled layout="control" %}
|
||||
{% bootstrap_field sform.waiting_list_auto layout="control" %}
|
||||
{% bootstrap_field sform.waiting_list_hours layout="control" %}
|
||||
|
||||
@@ -50,7 +50,7 @@ from django.views import View
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic.edit import DeleteView
|
||||
|
||||
from pretix.base.models import Item, WaitingListEntry
|
||||
from pretix.base.models import Item, Quota, WaitingListEntry
|
||||
from pretix.base.models.waitinglist import WaitingListException
|
||||
from pretix.base.services.waitinglist import assign_automatically
|
||||
from pretix.base.views.tasks import AsyncAction
|
||||
@@ -239,8 +239,24 @@ class WaitingListView(EventPermissionRequiredMixin, WaitingListQuerySetMixin, Pa
|
||||
if wle.variation
|
||||
else wle.item.check_quotas(count_waitinglist=False, subevent=wle.subevent, _cache=quota_cache)
|
||||
)
|
||||
if wle.availability[0] == Quota.AVAILABILITY_OK and ev.seat_category_mappings.filter(product=wle.item).exists():
|
||||
# See comment in WaitingListEntry.send_voucher() for rationale
|
||||
num_free_seats_for_product = ev.free_seats().filter(product=wle.item).count()
|
||||
num_valid_vouchers_for_product = self.request.event.vouchers.filter(
|
||||
Q(valid_until__isnull=True) | Q(valid_until__gte=now()),
|
||||
block_quota=True,
|
||||
item_id=wle.item_id,
|
||||
subevent=wle.subevent_id,
|
||||
waitinglistentries__isnull=False
|
||||
).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],
|
||||
min(free_seats, wle.availability[1])
|
||||
)
|
||||
|
||||
itemvar_cache[(wle.item, wle.variation, wle.subevent)] = wle.availability
|
||||
if wle.availability[0] == 100:
|
||||
if wle.availability[0] == Quota.AVAILABILITY_OK:
|
||||
any_avail = True
|
||||
|
||||
ctx['any_avail'] = any_avail
|
||||
|
||||
Reference in New Issue
Block a user