Only expire orders in the evening of their expiry date

This commit is contained in:
Raphael Michel
2016-09-02 09:52:36 +02:00
parent 70d6cb4255
commit 972ad211bf
3 changed files with 5 additions and 3 deletions

View File

@@ -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)