fix apply subscription

This commit is contained in:
2025-11-04 11:25:24 +01:00
parent a7d6d45a78
commit 491a7154e2
6 changed files with 117 additions and 5 deletions

View File

@@ -19,8 +19,8 @@ class Event(Base):
title: Mapped[str] = mapped_column(nullable=False)
event_time: Mapped[datetime] = mapped_column(nullable=False)
registration_deadline: Mapped[datetime] = mapped_column(nullable=False)
description: Mapped[str] = mapped_column()
recipe_link: Mapped[str] = mapped_column()
description: Mapped[str] = mapped_column(nullable=True)
recipe_link: Mapped[str] = mapped_column(nullable=True)
# Min and max number of people needed for cooking, doing the dishes and preparing the tables
team_cooking_min: Mapped[int] = mapped_column(default=3, nullable=False)

View File

@@ -42,9 +42,9 @@ def apply_subscriptions(session: Session, event: Event = None, dry_run: bool = F
query = select(Event).where(
~Event.subscriptions_applied,
~Event.ignore_subscriptions,
func.strftime("%Y-%m-%d %H:%M:%S", Event.event_time) >= today.isoformat(),
func.strftime("%Y-%m-%d %H:%M:%S", Event.event_time)
<= (today + datetime.timedelta(days=7)).isoformat(),
func.strftime("%Y-%m-%d", Event.event_time) >= today.strftime("%Y-%m-%d"),
func.strftime("%Y-%m-%d", Event.event_time)
<= (today + datetime.timedelta(days=7)).strftime("%Y-%m-%d"),
)
events = session.scalars(query).all()