api/transactions pretty
parent
cd36e12b68
commit
ae44534fc3
|
|
@ -91,19 +91,18 @@ func (router Router) APITransactions(w http.ResponseWriter, r *http.Request) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
houseRelatedDeltas := deltas.Like(ledger.LikeTransactions(
|
||||||
|
deltas.Like(ledger.LikeName(`^House`))...,
|
||||||
|
))
|
||||||
sixMonths := time.Hour * 24 * 365 / 2
|
sixMonths := time.Hour * 24 * 365 / 2
|
||||||
|
|
||||||
deltasForHouse := deltas.Like(ledger.LikeName(`^House`))
|
|
||||||
houseRelatedDeltas := deltas.Like(ledger.LikeTransactions(deltasForHouse...))
|
|
||||||
houseRelatedBalances := houseRelatedDeltas.Balances().
|
|
||||||
Group(`^[^:]*`).
|
|
||||||
WithBPIs(bpis).
|
|
||||||
NotLike(`^Withdrawal`)
|
|
||||||
|
|
||||||
json.NewEncoder(w).Encode(map[string]any{
|
json.NewEncoder(w).Encode(map[string]any{
|
||||||
"deltas": deltasForHouse.
|
"deltas": houseRelatedDeltas.
|
||||||
Like(ledger.LikeAfter(time.Now().Add(-1 * sixMonths / 3).Format("2006-01"))),
|
Like(ledger.LikeAfter(time.Now().Add(-1 * sixMonths).Format("2006-01"))),
|
||||||
"balances": houseRelatedBalances,
|
"balances": houseRelatedDeltas.Balances().
|
||||||
|
Like(`^(Zach|Bel|House[^:]*:Debts:)`).
|
||||||
|
Group(`^[^:]*`).
|
||||||
|
WithBPIs(bpis),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue