diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-28 23:32:26 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-28 23:32:26 -1000 |
| commit | d39220eac03fbc5b714bde989665ed1c92dd24a5 (patch) | |
| tree | 03e1985745043b9af6e7442ac21fdcd5d843146f /internal/handlers/handlers.go | |
| parent | 05b1930e04ac222d73ffb2f45c1b1febb69f893d (diff) | |
Expand agent context API with completed log and calendar view
- Add completed_tasks table to log task completions with title, due date,
and completion timestamp
- Extend agent context date range: 7 days back to 14 days forward
- Add completed_log to API response (last 50 completed tasks)
- Add day_section field to timeline items (overdue/today/tomorrow/later)
- Add calendar-style view for today's schedule (6am-10pm hourly grid)
- Add tabbed interface for Timeline vs Completed Log in HTML view
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/handlers/handlers.go')
| -rw-r--r-- | internal/handlers/handlers.go | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 9fe1b2c..0e5edcc 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -673,8 +673,11 @@ func (h *Handler) handleAtomToggle(w http.ResponseWriter, r *http.Request, compl } if complete { - // Get task title before removing from cache - title := h.getAtomTitle(id, source) + // Get task details before removing from cache + title, dueDate := h.getAtomDetails(id, source) + + // Log to completed tasks + _ = h.store.SaveCompletedTask(source, id, title, dueDate) // Remove from local cache switch source { @@ -706,14 +709,14 @@ func (h *Handler) handleAtomToggle(w http.ResponseWriter, r *http.Request, compl } } -// getAtomTitle retrieves the title for a task/card/bug from the store -func (h *Handler) getAtomTitle(id, source string) string { +// getAtomDetails retrieves title and due date for a task/card/bug from the store +func (h *Handler) getAtomDetails(id, source string) (string, *time.Time) { switch source { case "todoist": if tasks, err := h.store.GetTasks(); err == nil { for _, t := range tasks { if t.ID == id { - return t.Content + return t.Content, t.DueDate } } } @@ -722,7 +725,7 @@ func (h *Handler) getAtomTitle(id, source string) string { for _, b := range boards { for _, c := range b.Cards { if c.ID == id { - return c.Name + return c.Name, c.DueDate } } } @@ -733,13 +736,22 @@ func (h *Handler) getAtomTitle(id, source string) string { if _, err := fmt.Sscanf(id, "bug-%d", &bugID); err == nil { for _, b := range bugs { if b.ID == bugID { - return b.Description + return b.Description, nil } } } } + case "gtasks": + // Google Tasks don't have local cache, return generic title + return "Google Task", nil } - return "Task" + return "Task", nil +} + +// getAtomTitle retrieves the title for a task/card/bug from the store (legacy) +func (h *Handler) getAtomTitle(id, source string) string { + title, _ := h.getAtomDetails(id, source) + return title } // HandleUnifiedAdd creates a task in Todoist or a card in Trello from the Quick Add form |
