From caf39fe5ea503244dcea746865c29265206368ef Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Fri, 4 Mar 2022 21:18:44 +0000 Subject: [PATCH] Set Available balance of income category --- server/budgeting.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/budgeting.go b/server/budgeting.go index f4dd4af..5778c6b 100644 --- a/server/budgeting.go +++ b/server/budgeting.go @@ -98,6 +98,15 @@ func (h *Handler) budgetingForMonth(c *gin.Context) { categoriesWithBalance, moneyUsed := h.calculateBalances( budget, firstOfNextMonth, firstOfMonth, categories, cumultativeBalances) availableBalance := h.getAvailableBalance(budget, moneyUsed, cumultativeBalances, firstOfNextMonth) + for i := range categoriesWithBalance { + cat := &categoriesWithBalance[i] + if cat.ID != budget.IncomeCategoryID { + continue + } + + cat.Available = availableBalance + cat.AvailableLastMonth = availableBalance + } data := struct { Categories []CategoryWithBalance