activity: fix output after #1982; add tests
This commit is contained in:
parent
8e34c5253c
commit
25b8d51ff2
@ -43,7 +43,7 @@ showHistogram rspec@ReportSpec{_rsQuery=q} j =
|
||||
-- ps = sortBy (comparing postingDate) $ filterempties $ filter matchapats $ filterdepth $ journalPostings j
|
||||
ps = sortOn postingDate $ filter (q `matchesPosting`) $ journalPostings j
|
||||
|
||||
printDayWith f (DateSpan (Just b) _, ps) = printf "%s %s\n" (show b) (f ps)
|
||||
printDayWith f (DateSpan (Just b) _, ps) = printf "%s %s\n" (show $ fromEFDay b) (f ps)
|
||||
printDayWith _ _ = error "Expected start date for DateSpan" -- PARTIAL:
|
||||
|
||||
countBar ps = replicate (length ps) barchar
|
||||
|
||||
38
hledger/test/activity.test
Normal file
38
hledger/test/activity.test
Normal file
@ -0,0 +1,38 @@
|
||||
# 1. activity report is daily by default.
|
||||
<
|
||||
2023-01-01
|
||||
(a) 1
|
||||
|
||||
2023-01-06
|
||||
(a) 1
|
||||
|
||||
$ hledger -f - activity
|
||||
2023-01-01 *
|
||||
2023-01-02
|
||||
2023-01-03
|
||||
2023-01-04
|
||||
2023-01-05
|
||||
2023-01-06 *
|
||||
|
||||
# 2. A weekly activity report.
|
||||
<
|
||||
2023-01-01
|
||||
(a) 1
|
||||
|
||||
2023-01-06
|
||||
(a) 1
|
||||
|
||||
$ hledger -f - activity -W
|
||||
2022-12-26 *
|
||||
2023-01-02 *
|
||||
|
||||
# 2. A 7-day activity report starting on an date.
|
||||
<
|
||||
2023-01-01
|
||||
(a) 1
|
||||
|
||||
2023-01-06
|
||||
(a) 1
|
||||
|
||||
$ hledger -f - activity -W -b2023-01-01
|
||||
2023-01-01 **
|
||||
Loading…
Reference in New Issue
Block a user