diff --git a/cmd/clitest/main.go b/cmd/clitest/main.go index 01c096f..f2fefcc 100644 --- a/cmd/clitest/main.go +++ b/cmd/clitest/main.go @@ -55,9 +55,7 @@ func main() { for k, v := range deltas.Balances() { results := []string{} for subk, subv := range v { - if int(subv) != 0 { - results = append(results, fmt.Sprintf("%s %.2f", subk, subv)) - } + results = append(results, fmt.Sprintf("%s %.2f", subk, subv)) } if len(results) > 0 { fmt.Printf("%s\t%s\n", k, strings.Join(results, " + ")) diff --git a/ledger/deltas.go b/ledger/deltas.go index cb6a097..7169ef8 100644 --- a/ledger/deltas.go +++ b/ledger/deltas.go @@ -46,6 +46,9 @@ func (deltas Deltas) Balances() Balances { result[delta.Name][delta.Currency] = 0 } result[delta.Name][delta.Currency] += delta.Value + if result[delta.Name][delta.Currency] < 0.0000001 { + delete(result[delta.Name], delta.Currency) + } } return result