From 97242ee92845b07070008ea4f772a6bf3d4a0b0f Mon Sep 17 00:00:00 2001 From: Kyle Pope Date: Sat, 21 Feb 2026 11:58:36 +0800 Subject: [PATCH] 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 --- backend/app/routers/dashboard.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/app/routers/dashboard.py b/backend/app/routers/dashboard.py index 937dd82..b150b40 100644 --- a/backend/app/routers/dashboard.py +++ b/backend/app/routers/dashboard.py @@ -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()