mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
SubEvent: Automatically bump all orders when date is changed
This commit is contained in:
@@ -1113,12 +1113,28 @@ class SubEvent(EventMixin, LoggedModel):
|
||||
if self.event and clear_cache:
|
||||
self.event.cache.clear()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.__original_dates = (self.date_from, self.date_to)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
from .orders import Order
|
||||
|
||||
clear_cache = kwargs.pop('clear_cache', False)
|
||||
super().save(*args, **kwargs)
|
||||
if self.event and clear_cache:
|
||||
self.event.cache.clear()
|
||||
|
||||
if (self.date_from, self.date_to) != self.__original_dates:
|
||||
"""
|
||||
This is required to guarantee a synchronization invariant of our scanning apps.
|
||||
Our syncing apps throw away order records of subevents more than X days ago, since
|
||||
they are not interesting for ticket scanning and pose a performance hazard. However,
|
||||
the app needs to know when a subevent is moved to a date in the future, since that
|
||||
might require it to re-download and re-store the orders.
|
||||
"""
|
||||
Order.objects.filter(all_positions__subevent=self).update(last_modified=now())
|
||||
|
||||
@staticmethod
|
||||
def clean_items(event, items):
|
||||
for item in items:
|
||||
|
||||
Reference in New Issue
Block a user