fix: change GoalPlan int fields to int64 to match sub template func
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
99be71be8a
commit
35156e001d
@ -1423,21 +1423,21 @@ func (h *Handler) Goals(w http.ResponseWriter, r *http.Request) {
|
|||||||
remaining = 0
|
remaining = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
monthsLeft := monthsBetween(now, g.Deadline)
|
monthsLeft := int64(monthsBetween(now, g.Deadline))
|
||||||
if monthsLeft < 1 {
|
if monthsLeft < 1 {
|
||||||
monthsLeft = 1
|
monthsLeft = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
monthlyCents := remaining / int64(monthsLeft)
|
monthlyCents := remaining / monthsLeft
|
||||||
|
|
||||||
monthsAtRate := 0
|
monthsAtRate := int64(0)
|
||||||
if avgMonthlySavings > 0 {
|
if avgMonthlySavings > 0 {
|
||||||
monthsAtRate = int(remaining / avgMonthlySavings)
|
monthsAtRate = remaining / avgMonthlySavings
|
||||||
}
|
}
|
||||||
|
|
||||||
progressPct := 0
|
progressPct := int64(0)
|
||||||
if g.TargetCents > 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 {
|
if progressPct > 100 {
|
||||||
progressPct = 100
|
progressPct = 100
|
||||||
}
|
}
|
||||||
|
|||||||
@ -240,12 +240,12 @@ type Goal struct {
|
|||||||
// GoalPlan is computed at request time — never stored.
|
// GoalPlan is computed at request time — never stored.
|
||||||
type GoalPlan struct {
|
type GoalPlan struct {
|
||||||
Goal
|
Goal
|
||||||
MonthsLeft int
|
MonthsLeft int64
|
||||||
MonthlyCents int64 // required monthly contribution
|
MonthlyCents int64
|
||||||
ImpactOnDisposable int64 // how much disposable income this eats
|
ImpactOnDisposable int64
|
||||||
MonthsAtCurrentRate int // months to reach goal at current savings rate
|
MonthsAtCurrentRate int64
|
||||||
Feasible bool // can reach it by deadline at required monthly
|
Feasible bool
|
||||||
ProgressPct int
|
ProgressPct int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type GoalsData struct {
|
type GoalsData struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user