mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Tests: Fix two flaky tests (#4557)
* Test: Fix test that relies on unstable database result order * Tests: Fix test that fails between 0am and 1am
This commit is contained in:
@@ -156,7 +156,7 @@ def event_list(request):
|
||||
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
||||
).annotate(
|
||||
order_from=Coalesce('min_from', 'date_from'),
|
||||
).order_by('-order_from')
|
||||
).order_by('-order_from', 'slug')
|
||||
|
||||
total = qs.count()
|
||||
pagesize = 20
|
||||
@@ -318,7 +318,7 @@ def nav_context_list(request):
|
||||
max_fromto=Greatest(Max('subevents__date_to'), Max('subevents__date_from'))
|
||||
).annotate(
|
||||
order_from=Coalesce('min_from', 'date_from'),
|
||||
).order_by('-order_from')
|
||||
).order_by('-order_from', 'slug')
|
||||
|
||||
if request.user.has_active_staff_session(request.session.session_key):
|
||||
qs_orga = Organizer.objects.all()
|
||||
|
||||
@@ -210,7 +210,7 @@ class EventListMixin:
|
||||
)
|
||||
).annotate(
|
||||
order_to=Coalesce('max_fromto', 'max_to', 'max_from', 'date_to', 'date_from'),
|
||||
).order_by('-order_to')
|
||||
).order_by('-order_to', 'name', 'slug')
|
||||
else:
|
||||
date_q = Q(date_to__gte=now()) | (Q(date_to__isnull=True) & Q(date_from__gte=now()))
|
||||
qs = qs.filter(
|
||||
@@ -219,7 +219,7 @@ class EventListMixin:
|
||||
)
|
||||
).annotate(
|
||||
order_from=Coalesce('min_from', 'date_from'),
|
||||
).order_by('order_from')
|
||||
).order_by('order_from', 'name', 'slug')
|
||||
qs = Event.annotated(filter_qs_by_attr(
|
||||
qs, self.request, match_subevents_with_conditions=Q(active=True) & Q(is_public=True) & date_q
|
||||
), self.request.sales_channel)
|
||||
|
||||
Reference in New Issue
Block a user