From 35156e001de6943e6854dde6c11bdec38d3ad1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Rodrigues?= Date: Sat, 13 Jun 2026 16:33:15 +0100 Subject: [PATCH] fix: change GoalPlan int fields to int64 to match sub template func Co-Authored-By: Claude Sonnet 4.6 --- apps/finance/services/api/main/handler.go | 12 ++++++------ apps/finance/services/api/main/models.go | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/finance/services/api/main/handler.go b/apps/finance/services/api/main/handler.go index 8884713..548d7f0 100644 --- a/apps/finance/services/api/main/handler.go +++ b/apps/finance/services/api/main/handler.go @@ -1423,21 +1423,21 @@ func (h *Handler) Goals(w http.ResponseWriter, r *http.Request) { remaining = 0 } - monthsLeft := monthsBetween(now, g.Deadline) + monthsLeft := int64(monthsBetween(now, g.Deadline)) if monthsLeft < 1 { monthsLeft = 1 } - monthlyCents := remaining / int64(monthsLeft) + monthlyCents := remaining / monthsLeft - monthsAtRate := 0 + monthsAtRate := int64(0) if avgMonthlySavings > 0 { - monthsAtRate = int(remaining / avgMonthlySavings) + monthsAtRate = remaining / avgMonthlySavings } - progressPct := 0 + progressPct := int64(0) if g.TargetCents > 0 { - progressPct = int(float64(g.SavedCents) / float64(g.TargetCents) * 100) + progressPct = int64(float64(g.SavedCents) / float64(g.TargetCents) * 100) if progressPct > 100 { progressPct = 100 } diff --git a/apps/finance/services/api/main/models.go b/apps/finance/services/api/main/models.go index 9275e8f..7a01138 100644 --- a/apps/finance/services/api/main/models.go +++ b/apps/finance/services/api/main/models.go @@ -240,12 +240,12 @@ type Goal struct { // GoalPlan is computed at request time — never stored. type GoalPlan struct { Goal - MonthsLeft int - MonthlyCents int64 // required monthly contribution - ImpactOnDisposable int64 // how much disposable income this eats - MonthsAtCurrentRate int // months to reach goal at current savings rate - Feasible bool // can reach it by deadline at required monthly - ProgressPct int + MonthsLeft int64 + MonthlyCents int64 + ImpactOnDisposable int64 + MonthsAtCurrentRate int64 + Feasible bool + ProgressPct int64 } type GoalsData struct {