diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-07-16 06:46:53 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-07-16 06:46:53 +0000 |
| commit | 2413413b01925c7fab07768d7e405ac13c735000 (patch) | |
| tree | cc168393e8a2b9bb795e3003366be14e8d8303d6 /internal/models/widget.go | |
| parent | cef79fc49fd8d6e607c71432755812adca847ce2 (diff) | |
Surface budget_status on GET /api/widget when tracked tasks exist
Wires ComputeBudgetPeriod together with availability blocks, tracked
project/label sets, calendar events, and native tasks into a new
computeBudgetStatus helper on *Handler. HandleWidgetGet now populates
WidgetResponse.BudgetStatus with today/week periods, but only when at
least one incomplete budget-tracked task exists in the rolling week
window -- otherwise the field is omitted entirely so unconfigured users
see no new UI. Errors are logged and swallowed, matching the existing
resilience pattern for this widget endpoint.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PQaPGQVSfmKUiHXB87qRTC
Diffstat (limited to 'internal/models/widget.go')
| -rw-r--r-- | internal/models/widget.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/models/widget.go b/internal/models/widget.go index da13008..bf148fd 100644 --- a/internal/models/widget.go +++ b/internal/models/widget.go @@ -23,6 +23,7 @@ type WidgetItem struct { // WidgetResponse is the full /api/widget response body. type WidgetResponse struct { - Now time.Time `json:"now"` - Items []WidgetItem `json:"items"` + Now time.Time `json:"now"` + Items []WidgetItem `json:"items"` + BudgetStatus *BudgetStatus `json:"budget_status,omitempty"` } |
