Fix dashboard endpoint returning past todos and reminders
- Add lower-bound filter (>= today) for upcoming_todos in /dashboard - Add lower-bound filter (>= today_start) for active_reminders - Prevents DayBriefing summary from referencing stale items Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c2c4446ea6
commit
97242ee928
@ -35,19 +35,21 @@ async def get_dashboard(
|
||||
events_result = await db.execute(events_query)
|
||||
todays_events = events_result.scalars().all()
|
||||
|
||||
# Upcoming todos (not completed, with due date within upcoming_days)
|
||||
# Upcoming todos (not completed, with due date from today through upcoming_days)
|
||||
todos_query = select(Todo).where(
|
||||
Todo.completed == False,
|
||||
Todo.due_date.isnot(None),
|
||||
Todo.due_date >= today,
|
||||
Todo.due_date <= upcoming_cutoff
|
||||
).order_by(Todo.due_date.asc())
|
||||
todos_result = await db.execute(todos_query)
|
||||
upcoming_todos = todos_result.scalars().all()
|
||||
|
||||
# Active reminders (not dismissed, is_active = true)
|
||||
# Active reminders (not dismissed, is_active = true, from today onward)
|
||||
reminders_query = select(Reminder).where(
|
||||
Reminder.is_active == True,
|
||||
Reminder.is_dismissed == False
|
||||
Reminder.is_dismissed == False,
|
||||
Reminder.remind_at >= today_start
|
||||
).order_by(Reminder.remind_at.asc())
|
||||
reminders_result = await db.execute(reminders_query)
|
||||
active_reminders = reminders_result.scalars().all()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user