register command sorts transactions by date
(unlike ledger)
This commit is contained in:
parent
8256a4fcbd
commit
7521992e85
@ -33,7 +33,8 @@ showRegisterReport opts args l
|
|||||||
| otherwise = showtxns summaryts nulltxn startbal
|
| otherwise = showtxns summaryts nulltxn startbal
|
||||||
where
|
where
|
||||||
interval = intervalFromOpts opts
|
interval = intervalFromOpts opts
|
||||||
ts = filterempties $ filter matchapats $ filterdepth $ ledgerTransactions l
|
ts = sort $ filterempties $ filter matchapats $ filterdepth $ ledgerTransactions l
|
||||||
|
where sort = sortBy (\a b -> compare (date a) (date b))
|
||||||
filterdepth | interval == NoInterval = filter (\t -> (accountNameLevel $ account t) <= depth)
|
filterdepth | interval == NoInterval = filter (\t -> (accountNameLevel $ account t) <= depth)
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
filterempties
|
filterempties
|
||||||
|
|||||||
13
Tests.hs
13
Tests.hs
@ -447,6 +447,19 @@ tests = [
|
|||||||
," assets:bank:checking $-1 0"
|
," assets:bank:checking $-1 0"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
,"register report sorts by date" ~:
|
||||||
|
do
|
||||||
|
l <- ledgerfromstringwithopts [] [] sampletime $ unlines
|
||||||
|
["2008/02/02 a"
|
||||||
|
," b 1"
|
||||||
|
," c"
|
||||||
|
,""
|
||||||
|
,"2008/01/01 d"
|
||||||
|
," e 1"
|
||||||
|
," f"
|
||||||
|
]
|
||||||
|
registerdates (showRegisterReport [] [] l) `is` ["2008/01/01","2008/02/02"]
|
||||||
|
|
||||||
,"register report with account pattern" ~:
|
,"register report with account pattern" ~:
|
||||||
do
|
do
|
||||||
l <- sampleledger
|
l <- sampleledger
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user