Disable shop and waiting list after end of event

This commit is contained in:
Raphael Michel
2018-02-04 14:14:49 +01:00
parent 2f00db8081
commit 67678e35bb
11 changed files with 126 additions and 26 deletions

View File

@@ -112,7 +112,7 @@ class CartManager:
def _check_presale_dates(self):
if self.event.presale_start and self.now_dt < self.event.presale_start:
raise CartError(error_messages['not_started'])
if self.event.presale_end and self.now_dt > self.event.presale_end:
if self.event.presale_has_ended:
raise CartError(error_messages['ended'])
def _extend_expiry_of_valid_existing_positions(self):

View File

@@ -321,7 +321,7 @@ class OrderError(LazyLocaleException):
def _check_date(event: Event, now_dt: datetime):
if event.presale_start and now_dt < event.presale_start:
raise OrderError(error_messages['not_started'])
if event.presale_end and now_dt > event.presale_end:
if event.presale_has_ended:
raise OrderError(error_messages['ended'])

View File

@@ -35,6 +35,10 @@ def assign_automatically(event_id: int, user_id: int=None, subevent_id: int=None
if (wle.item, wle.variation) in gone:
continue
ev = (wle.subevent or event)
if not ev.presale_is_running:
continue
quotas = (wle.variation.quotas.filter(subevent=wle.subevent)
if wle.variation
else wle.item.quotas.filter(subevent=wle.subevent))
@@ -66,5 +70,5 @@ def assign_automatically(event_id: int, user_id: int=None, subevent_id: int=None
def process_waitinglist(sender, **kwargs):
qs = Event.objects.prefetch_related('_settings_objects', 'organizer___settings_objects').select_related('organizer')
for e in qs:
if e.settings.waiting_list_enabled and e.settings.waiting_list_auto:
if e.settings.waiting_list_enabled and e.settings.waiting_list_auto and e.presale_is_running:
assign_automatically.apply_async(args=(e.pk,))