Implement basic budgeting input #39

Merged
jacob1123 merged 16 commits from budgeting into master 2022-03-05 22:12:15 +01:00
Showing only changes of commit fc29b1409d - Show all commits

View File

@ -204,10 +204,10 @@ func (*Handler) CalculateCategoryBalances(cat *postgres.GetCategoriesRow,
} }
moneyUsed.SubI(bal.Assignments) moneyUsed.SubI(bal.Assignments)
categoryWithBalance.Available = categoryWithBalance.Available.Add(bal.Assignments) categoryWithBalance.Available.AddI(bal.Assignments)
categoryWithBalance.Available = categoryWithBalance.Available.Add(bal.Transactions) categoryWithBalance.Available.AddI(bal.Transactions)
if !categoryWithBalance.Available.IsPositive() && bal.Date.Before(firstOfMonth) { if !categoryWithBalance.Available.IsPositive() && bal.Date.Before(firstOfMonth) {
moneyUsed.Add(categoryWithBalance.Available) moneyUsed.AddI(categoryWithBalance.Available)
categoryWithBalance.Available = numeric.Zero() categoryWithBalance.Available = numeric.Zero()
} }