From c73020b00c9138e9bca6ede2809829fef1a01d32 Mon Sep 17 00:00:00 2001 From: Felix Blanke <info@fblanke.de> Date: Fri, 27 Dec 2024 14:59:11 +0100 Subject: [PATCH] Use uniform discretization if no default slots exist --- AKModel/views/ak.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AKModel/views/ak.py b/AKModel/views/ak.py index 44fbc096..93d790f8 100644 --- a/AKModel/views/ak.py +++ b/AKModel/views/ak.py @@ -114,7 +114,13 @@ class AKJSONExportView(AdminViewMixin, FilterByEventSlugMixin, ListView): if (values := AKSlot.objects.select_related().filter(ak__pk=ak_id, fixed=True)).exists() } - for block in merge_blocks(self.event.default_time_slots(slots_in_an_hour=SLOTS_IN_AN_HOUR)): + if DefaultSlot.objects.filter(event=self).exists(): + # discretize default slots if they exists + blocks = merge_blocks(self.event.default_time_slots(slots_in_an_hour=SLOTS_IN_AN_HOUR)) + else: + blocks = self.event.uniform_time_slots(slos_in_an_hour=SLOTS_IN_AN_HOUR) + + for block in blocks: current_block = [] for timeslot in block: -- GitLab