forked from CGM_Public/pretix_original
Only expire orders in the evening of their expiry date
This commit is contained in:
@@ -250,7 +250,7 @@ class Order(LoggedModel):
|
||||
@property
|
||||
def is_expired_by_time(self):
|
||||
return (
|
||||
self.status == Order.STATUS_PENDING and self.expires < now()
|
||||
self.status == Order.STATUS_PENDING and self.expires.date() < now().date()
|
||||
and not self.event.settings.get('payment_term_expire_automatically')
|
||||
)
|
||||
|
||||
|
||||
@@ -355,7 +355,9 @@ def perform_order(event: str, payment_provider: str, positions: List[str],
|
||||
@receiver(signal=periodic_task)
|
||||
def expire_orders(sender, **kwargs):
|
||||
eventcache = {}
|
||||
for o in Order.objects.filter(expires__lt=now(), status=Order.STATUS_PENDING).select_related('event'):
|
||||
today = now().date()
|
||||
|
||||
for o in Order.objects.filter(expires__lt=today, status=Order.STATUS_PENDING).select_related('event'):
|
||||
expire = eventcache.get(o.event.pk, None)
|
||||
if expire is None:
|
||||
expire = o.event.settings.get('payment_term_expire_automatically', as_type=bool)
|
||||
|
||||
Reference in New Issue
Block a user