From f01b2924bf0b62fc20af0d09581d101418455b1c Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sun, 12 Jul 2026 07:40:30 +0000 Subject: fix(timeline): include overdue native tasks in timeline and widget GetNativeTasksByDateRange's SQL bound (due_date >= start) excluded any task overdue from a previous day before ComputeDaySection ever got a chance to mark it IsOverdue, so both the web Timeline view and the widget API (which both call BuildTimeline with start = today) silently dropped overdue tasks entirely -- only the Tasks tab (unbounded GetNativeTasks) showed them. Added GetOverdueNativeTasks and folded its results into BuildTimeline alongside the ranged fetch. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01VTUSAEKfsPc6WGDq45yPHD --- internal/handlers/timeline_logic.go | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'internal/handlers/timeline_logic.go') diff --git a/internal/handlers/timeline_logic.go b/internal/handlers/timeline_logic.go index 67ba09d..e7c1279 100644 --- a/internal/handlers/timeline_logic.go +++ b/internal/handlers/timeline_logic.go @@ -125,7 +125,10 @@ func BuildTimeline(ctx context.Context, s *store.Store, start, end time.Time) ([ } } - // 6. Fetch native (doot-owned) tasks + // 6. Fetch native (doot-owned) tasks due within the range, plus any + // overdue tasks (due before the range's start) so they still surface -- + // GetNativeTasksByDateRange's lower bound would otherwise drop them + // before ComputeDaySection ever gets a chance to mark them IsOverdue. nativeDated, err := s.GetNativeTasksByDateRange(start, end) if err != nil { log.Printf("Warning: failed to read native tasks: %v", err) @@ -149,6 +152,29 @@ func BuildTimeline(ctx context.Context, s *store.Store, start, end time.Time) ([ } } + nativeOverdue, err := s.GetOverdueNativeTasks(start) + if err != nil { + log.Printf("Warning: failed to read overdue native tasks: %v", err) + } else { + for _, task := range nativeOverdue { + if task.DueDate == nil { + continue + } + item := models.TimelineItem{ + ID: task.ID, + Type: models.TimelineItemTypeTask, + Title: task.Content, + Time: *task.DueDate, + Description: task.Description, + OriginalItem: task, + IsCompleted: task.Completed, + Source: "doot", + } + item.ComputeDaySection(now) + items = append(items, item) + } + } + nativeUndated, err := s.GetUndatedNativeTasks() if err != nil { log.Printf("Warning: failed to read undated native tasks: %v", err) -- cgit v1.2.3