From eac34e85fa1b0c435254df964e100de0cf11968f Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 14 Jan 2011 04:18:58 +0000 Subject: [PATCH] histogram: honour the specified start or end dates --- hledger/Hledger/Cli/Histogram.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hledger/Hledger/Cli/Histogram.hs b/hledger/Hledger/Cli/Histogram.hs index 9acc3d84d..7054f67c5 100644 --- a/hledger/Hledger/Cli/Histogram.hs +++ b/hledger/Hledger/Cli/Histogram.hs @@ -23,14 +23,14 @@ histogram opts args j = do putStr $ showHistogram opts (optsToFilterSpec opts args t) j showHistogram :: [Opt] -> FilterSpec -> Journal -> String -showHistogram opts filterspec j = concatMap (printDayWith countBar) dayps +showHistogram opts filterspec j = concatMap (printDayWith countBar) spanps where i = intervalFromOpts opts interval | i == NoInterval = Days 1 | otherwise = i - fullspan = journalDateSpan j - days = filter (DateSpan Nothing Nothing /=) $ splitSpan interval fullspan - dayps = [(s, filter (isPostingInDateSpan s) ps) | s <- days] + span = datespan filterspec `orDatesFrom` journalDateSpan j + spans = filter (DateSpan Nothing Nothing /=) $ splitSpan interval span + spanps = [(s, filter (isPostingInDateSpan s) ps) | s <- spans] -- same as Register -- should count transactions, not postings ? ps = sortBy (comparing postingDate) $ filterempties $ filter matchapats $ filterdepth $ journalPostings j