summaryrefslogtreecommitdiff
path: root/internal/handlers/timeline_logic.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/timeline_logic.go')
-rw-r--r--internal/handlers/timeline_logic.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/internal/handlers/timeline_logic.go b/internal/handlers/timeline_logic.go
index adfa406..145e851 100644
--- a/internal/handlers/timeline_logic.go
+++ b/internal/handlers/timeline_logic.go
@@ -18,7 +18,7 @@ func BuildTimeline(ctx context.Context, s *store.Store, tasksClient api.GoogleTa
var items []models.TimelineItem
now := config.Now()
- // 1. Fetch Tasks
+ // 1. Fetch Tasks (dated)
tasks, err := s.GetTasksByDateRange(start, end)
if err != nil {
return nil, err
@@ -42,6 +42,29 @@ func BuildTimeline(ctx context.Context, s *store.Store, tasksClient api.GoogleTa
items = append(items, item)
}
+ // 1b. Fetch undated Tasks — place in Today section
+ undatedTasks, err := s.GetUndatedTasks()
+ if err != nil {
+ log.Printf("Warning: failed to fetch undated tasks: %v", err)
+ } else {
+ for _, task := range undatedTasks {
+ item := models.TimelineItem{
+ ID: task.ID,
+ Type: models.TimelineItemTypeTask,
+ Title: task.Content,
+ Time: now,
+ Description: task.Description,
+ URL: task.URL,
+ OriginalItem: task,
+ IsCompleted: task.Completed,
+ Source: "todoist",
+ IsAllDay: true,
+ }
+ item.ComputeDaySection(now)
+ items = append(items, item)
+ }
+ }
+
// 2. Fetch Meals - combine multiple items for same date+mealType
meals, err := s.GetMealsByDateRange(start, end)
if err != nil {