From c528c93a3d86337b93b981cab303c68883bc79e0 Mon Sep 17 00:00:00 2001 From: Hugh Wells Date: Tue, 28 May 2024 17:36:24 +0100 Subject: [PATCH] Actually limit the number of LTs --- models/cfp.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/models/cfp.py b/models/cfp.py index 4c8e22ddd..1a2fb1b74 100644 --- a/models/cfp.py +++ b/models/cfp.py @@ -947,13 +947,12 @@ def get_remaining_lightning_slots(cls): day: count for (day, count) in cls.query.with_entities( cls.session, - func.count(cls.id), + # This is a horrible hack but we need to limit the LT slots for now + # and they have been preseeded as 12 in the DB (which is more than we can fit) + func.least(func.count(cls.id), 6) ) .filter(cls.state != "withdrawn") .group_by(cls.session) - # This is a horrible hack but we need to limit the LT slots for now - # and they have been preseeded as 12 in the DB (which is more than we can fit) - .limit(6) .all() } return {day: (count - day_counts.get(day, 0)) for (day, count) in slots.items()}