fix apply subscription
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user