file.Delta has sorted transactions with isSet

This commit is contained in:
Bel LaPointe
2023-10-25 11:27:01 -06:00
parent 0267819b45
commit cd38f0669f

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"io"
"os"
"sort"
"unicode"
)
@@ -89,6 +90,10 @@ func (files Files) Deltas(like ...Like) (Deltas, error) {
if err != nil {
return nil, err
}
sort.Slice(transactions, func(i, j int) bool {
return fmt.Sprintf("%s %s", transactions[i].date, transactions[i].description) < fmt.Sprintf("%s %s", transactions[j].date, transactions[j].description)
})
result := make(Deltas, 0, len(transactions)*2)
for _, transaction := range transactions {
sums := map[string]float64{}