Skip to content

Commit

Permalink
already sorted by cliTransactions function
Browse files Browse the repository at this point in the history
  • Loading branch information
howeyc committed Oct 3, 2024
1 parent 563f491 commit 50ec18f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
7 changes: 0 additions & 7 deletions ledger/cmd/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,6 @@ func WriteTransaction(w io.StringWriter, trans *ledger.Transaction, columns int)

// PrintLedger prints all transactions as a formatted ledger file.
func PrintLedger(generalLedger []*ledger.Transaction, filterArr []string, columns int) {
// Print transactions by date
if len(generalLedger) > 1 {
slices.SortStableFunc(generalLedger, func(a, b *ledger.Transaction) int {
return a.Date.Compare(b.Date)
})
}

buf := bufio.NewWriter(os.Stdout)
for _, trans := range generalLedger {
inFilter := len(filterArr) == 0
Expand Down
4 changes: 0 additions & 4 deletions ledger/cmd/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"log"
"math"
"slices"
"strings"
"time"

Expand All @@ -31,9 +30,6 @@ func printStats(generalLedger []*ledger.Transaction) {
fmt.Println("Empty ledger.")
return
}
slices.SortFunc(generalLedger, func(a, b *ledger.Transaction) int {
return a.Date.Compare(b.Date)
})

startDate := generalLedger[0].Date
endDate := generalLedger[len(generalLedger)-1].Date
Expand Down

0 comments on commit 50ec18f

Please sign in to comment.