Fix calls to isAfter and so on
This commit is contained in:
parent
54e591bc5e
commit
35690681cf
@ -88,7 +88,7 @@ func (*Handler) getAvailableBalance(budget postgres.Budget, month Month,
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if !month.nextMonth().isAfter(bal.Date) {
|
if !month.InPast(bal.Date) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,19 +152,19 @@ func (h *Handler) calculateBalances(budget postgres.Budget, month Month,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// skip everything in the future
|
// skip everything in the future
|
||||||
if month.nextMonth().isAfter(bal.Date) {
|
if month.InFuture(bal.Date) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
moneyUsed.SubI(bal.Assignments)
|
moneyUsed.SubI(bal.Assignments)
|
||||||
categoryWithBalance.Available.AddI(bal.Assignments)
|
categoryWithBalance.Available.AddI(bal.Assignments)
|
||||||
categoryWithBalance.Available.AddI(bal.Transactions)
|
categoryWithBalance.Available.AddI(bal.Transactions)
|
||||||
if !categoryWithBalance.Available.IsPositive() && month.isAfter(bal.Date) {
|
if !categoryWithBalance.Available.IsPositive() && month.InPast(bal.Date) {
|
||||||
moneyUsed.AddI(categoryWithBalance.Available)
|
moneyUsed.AddI(categoryWithBalance.Available)
|
||||||
categoryWithBalance.Available = numeric.Zero()
|
categoryWithBalance.Available = numeric.Zero()
|
||||||
}
|
}
|
||||||
|
|
||||||
if month.contains(bal.Date) {
|
if month.InPresent(bal.Date) {
|
||||||
categoryWithBalance.Activity = bal.Transactions
|
categoryWithBalance.Activity = bal.Transactions
|
||||||
categoryWithBalance.Assigned = bal.Assignments
|
categoryWithBalance.Assigned = bal.Assignments
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user