From acc4a167b199df8ace5601c203b6e0d181e190fa Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 19 Jan 2022 14:58:09 +0100 Subject: [PATCH] Event series calendar: Fix incorrect show_names heuristic --- src/pretix/presale/views/event.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pretix/presale/views/event.py b/src/pretix/presale/views/event.py index 860ad0360d..51d956b7af 100644 --- a/src/pretix/presale/views/event.py +++ b/src/pretix/presale/views/event.py @@ -592,7 +592,7 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView): # an extra query to look at the entire series. For performance reasons, we have a limit on how many different names we look at. context['show_names'] = sum(len(i) for i in ebd.values() if isinstance(i, list)) < 2 or self.request.event.cache.get_or_set( 'has_different_subevent_names', - lambda: len(set(str(n) for n in self.request.event.subevents.values_list('name', flat=True).annotate(c=Count('*'))[:250])) != 1, + lambda: len(set(str(n) for n in self.request.event.subevents.order_by().values_list('name', flat=True).annotate(c=Count('*'))[:250])) != 1, timeout=120, ) context['weeks'] = weeks_for_template(ebd, self.year, self.month) @@ -626,7 +626,7 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView): # an extra query to look at the entire series. For performance reasons, we have a limit on how many different names we look at. context['show_names'] = sum(len(i) for i in ebd.values() if isinstance(i, list)) < 2 or self.request.event.cache.get_or_set( 'has_different_subevent_names', - lambda: len(set(str(n) for n in self.request.event.subevents.values_list('name', flat=True).annotate(c=Count('*'))[:250])) != 1, + lambda: len(set(str(n) for n in self.request.event.subevents.order_by().values_list('name', flat=True).annotate(c=Count('*'))[:250])) != 1, timeout=120, ) context['days'] = days_for_template(ebd, week)