mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-20 03:35:35 -04:00
Fix odysseus-calendar list dropping in-progress / multi-day events (#2065)
cmd_list filtered on the event START falling inside the window (dtstart >= start AND dtstart < end). The canonical web route (routes/calendar_routes.py) and the recurrence contract test use OVERLAP semantics for non-recurring events: dtstart < end AND dtend > start. So an event that began before the window but is still ongoing inside it — e.g. a 09:00-17:00 conference listed at 14:00, or any multi-day event spanning the window — was silently dropped by the CLI even though the web UI shows it. Use overlap, matching the route. dtend is NOT NULL in the schema, so no null-end regression.
This commit is contained in:
@@ -103,9 +103,13 @@ def cmd_list(args) -> None:
|
||||
end = _parse_dt(args.end) if args.end else (start + timedelta(days=30))
|
||||
db = SessionLocal()
|
||||
try:
|
||||
# Overlap semantics, matching the web route (routes/calendar_routes.py)
|
||||
# and the recurring-expansion contract: an event is in the window when
|
||||
# it starts before the window end AND ends after the window start. This
|
||||
# includes multi-day / in-progress events that began before `start`.
|
||||
q = db.query(CalendarEvent).filter(
|
||||
CalendarEvent.dtstart >= start,
|
||||
CalendarEvent.dtstart < end,
|
||||
CalendarEvent.dtend > start,
|
||||
)
|
||||
if args.calendar:
|
||||
cal = db.query(CalendarCal).filter(CalendarCal.name == args.calendar).first()
|
||||
|
||||
Reference in New Issue
Block a user