diff options
Diffstat (limited to 'internal/handlers/timeline_logic.go')
| -rw-r--r-- | internal/handlers/timeline_logic.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/internal/handlers/timeline_logic.go b/internal/handlers/timeline_logic.go index b25be1f..881ae78 100644 --- a/internal/handlers/timeline_logic.go +++ b/internal/handlers/timeline_logic.go @@ -245,6 +245,44 @@ func BuildTimeline(ctx context.Context, s *store.Store, start, end time.Time) ([ } } + // Tasks explicitly committed to today. This is the only way chain steps and + // other undated backlog work reach the day at all -- they carry no due date + // by design (see migration 031), so nothing above picks them up. + // + // Deduped against everything already added: "committed" and "due today" are + // two independent reasons for the same row, and a task can have both. + seen := make(map[string]bool, len(items)) + for _, item := range items { + seen[item.ID] = true + } + committed, err := s.GetCommittedTasks(now) + if err != nil { + log.Printf("Warning: failed to read committed tasks: %v", err) + } else { + for _, task := range committed { + if seen[task.ID] { + continue + } + item := models.TimelineItem{ + ID: task.ID, + Type: models.TimelineItemTypeTask, + Title: task.Content, + Time: now, + Description: task.Description, + OriginalItem: task, + IsCompleted: task.Completed, + Source: "doot", + IsAllDay: true, + Undated: true, + ProjectColor: projectColors[task.ProjectID], + } + setChainBadge(s, &item, task) + item.BucketState = task.BucketState + item.ComputeDaySection(now) + items = append(items, item) + } + } + // Sort items by Time sort.Slice(items, func(i, j int) bool { return items[i].Time.Before(items[j].Time) |
