mirror of
https://github.com/pretix/pretix.git
synced 2026-05-17 17:14:04 +00:00
use correct aggregation
This commit is contained in:
@@ -46,7 +46,7 @@ from django.conf import settings
|
|||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import DatabaseError, transaction
|
from django.db import DatabaseError, transaction
|
||||||
from django.db.models import Count, Exists, IntegerField, OuterRef, Q, Value
|
from django.db.models import Count, Exists, IntegerField, OuterRef, Q, Value
|
||||||
from django.db.models.aggregates import Max
|
from django.db.models.aggregates import Min
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.utils.timezone import make_aware, now
|
from django.utils.timezone import make_aware, now
|
||||||
from django.utils.translation import (
|
from django.utils.translation import (
|
||||||
@@ -339,7 +339,7 @@ class CartManager:
|
|||||||
# Make sure we do not extend past the max_extend timestamp, allowing users to extend their valid positions up
|
# Make sure we do not extend past the max_extend timestamp, allowing users to extend their valid positions up
|
||||||
# to 11 times the reservation time. After that, positions will expire, but can still be re-validated using
|
# to 11 times the reservation time. After that, positions will expire, but can still be re-validated using
|
||||||
# ExtendOperation.
|
# ExtendOperation.
|
||||||
max_extend_existing = self.positions.filter(expires__gt=self.real_now_dt).aggregate(m=Max('max_extend'))['m']
|
max_extend_existing = self.positions.filter(expires__gt=self.real_now_dt).aggregate(m=Min('max_extend'))['m']
|
||||||
if max_extend_existing:
|
if max_extend_existing:
|
||||||
self._expiry = min(self._expiry, max_extend_existing)
|
self._expiry = min(self._expiry, max_extend_existing)
|
||||||
self._max_expiry_extend = max_extend_existing
|
self._max_expiry_extend = max_extend_existing
|
||||||
|
|||||||
Reference in New Issue
Block a user