transactions.html omits non-payee currency and value table cells
All checks were successful
cicd / ci (push) Successful in 1m3s

This commit is contained in:
bel
2024-07-20 20:45:31 -06:00
parent 59205fba4c
commit 45c4d7b684
3 changed files with 47 additions and 5 deletions

View File

@@ -45,6 +45,11 @@ func (transaction Transaction) Payee() string {
candidates := []string{}
for name, balance := range balances {
deltas := Deltas(transaction).Like(LikeName(`^` + name + `$`))
if len(deltas) != 1 {
continue
}
everyoneElse := balances.NotLike(`^` + name + `$`).Group(`^`)[""]
matches := true
for currency, value := range balance {
@@ -192,7 +197,18 @@ func readTransaction(name string, r *bufio.Reader) (transaction, error) {
sumPerRecipient[recipient.name] += recipient.value
}
slices.Sort(recipients)
for _, k := range recipients {
n := 0
for i := range result.recipients {
if result.recipients[i].name == k {
n += 1
}
}
if n != 1 {
continue
}
v := sumPerRecipient[k]
everyoneElse := 0.0
for j := range sumPerRecipient {