WIP api transactions doesnt return net house debt hrmmmm
cicd / ci (push) Successful in 1m39s
Details
cicd / ci (push) Successful in 1m39s
Details
parent
fe8d80ffc8
commit
9a0eb89f54
|
|
@ -90,12 +90,20 @@ func (router Router) APITransactions(w http.ResponseWriter, r *http.Request) {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
json.NewEncoder(w).Encode(map[string]any{
|
||||
"deltas": deltas.Like(ledger.LikeAfter(time.Now().Add(-1 * time.Hour * 24 * 365 / 2).Format("2006-01"))),
|
||||
"balances": deltas.Balances().
|
||||
Like("^(Bel:Asset|Zach:Asset|HouseyMcHouseface:Debts:Credit)").
|
||||
|
||||
sixMonths := time.Hour * 24 * 365 / 2
|
||||
|
||||
deltasForHouse := deltas.Like(ledger.LikeName(`^House`))
|
||||
houseRelatedDeltas := deltas.Like(ledger.LikeTransactions(deltasForHouse...))
|
||||
houseRelatedBalances := houseRelatedDeltas.Balances().
|
||||
Group(`^[^:]*`).
|
||||
WithBPIs(bpis),
|
||||
WithBPIs(bpis).
|
||||
NotLike(`^Withdrawal`)
|
||||
|
||||
json.NewEncoder(w).Encode(map[string]any{
|
||||
"deltas": deltasForHouse.
|
||||
Like(ledger.LikeAfter(time.Now().Add(-1 * sixMonths / 3).Format("2006-01"))),
|
||||
"balances": houseRelatedBalances,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue