Set Available balance of income category
This commit is contained in:
parent
0dde94f855
commit
caf39fe5ea
@ -98,6 +98,15 @@ func (h *Handler) budgetingForMonth(c *gin.Context) {
|
|||||||
categoriesWithBalance, moneyUsed := h.calculateBalances(
|
categoriesWithBalance, moneyUsed := h.calculateBalances(
|
||||||
budget, firstOfNextMonth, firstOfMonth, categories, cumultativeBalances)
|
budget, firstOfNextMonth, firstOfMonth, categories, cumultativeBalances)
|
||||||
availableBalance := h.getAvailableBalance(budget, moneyUsed, cumultativeBalances, firstOfNextMonth)
|
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 {
|
data := struct {
|
||||||
Categories []CategoryWithBalance
|
Categories []CategoryWithBalance
|
||||||
|
Loading…
x
Reference in New Issue
Block a user