From 2413413b01925c7fab07768d7e405ac13c735000 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Thu, 16 Jul 2026 06:46:53 +0000 Subject: 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 Claude-Session: https://claude.ai/code/session_01PQaPGQVSfmKUiHXB87qRTC --- internal/models/widget.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'internal/models') 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"` } -- cgit v1.2.3