commit
						820f230c31
					
				| @ -97,8 +97,8 @@ tests_Hledger_Cli = TestList | |||||||
|    ,"account directive should preserve \"virtual\" posting type" ~: do |    ,"account directive should preserve \"virtual\" posting type" ~: do | ||||||
|       j <- readJournal Nothing Nothing Nothing "!account test\n2008/12/07 One\n  (from)  $-1\n  (to)  $1\n" >>= either error' return |       j <- readJournal Nothing Nothing Nothing "!account test\n2008/12/07 One\n  (from)  $-1\n  (to)  $1\n" >>= either error' return | ||||||
|       let p = head $ tpostings $ head $ jtxns j |       let p = head $ tpostings $ head $ jtxns j | ||||||
|       assertBool "" $ (paccount p) == "test:from" |       assertBool "" $ paccount p == "test:from" | ||||||
|       assertBool "" $ (ptype p) == VirtualPosting |       assertBool "" $ ptype p == VirtualPosting | ||||||
| 
 | 
 | ||||||
|    ] |    ] | ||||||
| 
 | 
 | ||||||
| @ -188,6 +188,7 @@ sample_journal_str = unlines | |||||||
|  ] |  ] | ||||||
| -} | -} | ||||||
| 
 | 
 | ||||||
|  | defaultyear_journal_str :: String | ||||||
| defaultyear_journal_str = unlines | defaultyear_journal_str = unlines | ||||||
|  ["Y2009" |  ["Y2009" | ||||||
|  ,"" |  ,"" | ||||||
| @ -337,9 +338,10 @@ defaultyear_journal_str = unlines | |||||||
| --  ,"" | --  ,"" | ||||||
| --  ] | --  ] | ||||||
| 
 | 
 | ||||||
|  | journal7 :: Journal | ||||||
| journal7 = nulljournal {jtxns =  | journal7 = nulljournal {jtxns =  | ||||||
|           [ |           [ | ||||||
|            txnTieKnot $ Transaction { |            txnTieKnot Transaction { | ||||||
|              tdate=parsedate "2007/01/01", |              tdate=parsedate "2007/01/01", | ||||||
|              tdate2=Nothing, |              tdate2=Nothing, | ||||||
|              tstatus=False, |              tstatus=False, | ||||||
| @ -354,7 +356,7 @@ journal7 = nulljournal {jtxns = | |||||||
|              tpreceding_comment_lines="" |              tpreceding_comment_lines="" | ||||||
|            } |            } | ||||||
|           , |           , | ||||||
|            txnTieKnot $ Transaction { |            txnTieKnot Transaction { | ||||||
|              tdate=parsedate "2007/02/01", |              tdate=parsedate "2007/02/01", | ||||||
|              tdate2=Nothing, |              tdate2=Nothing, | ||||||
|              tstatus=False, |              tstatus=False, | ||||||
| @ -369,7 +371,7 @@ journal7 = nulljournal {jtxns = | |||||||
|              tpreceding_comment_lines="" |              tpreceding_comment_lines="" | ||||||
|            } |            } | ||||||
|           , |           , | ||||||
|            txnTieKnot $ Transaction { |            txnTieKnot Transaction { | ||||||
|              tdate=parsedate "2007/01/02", |              tdate=parsedate "2007/01/02", | ||||||
|              tdate2=Nothing, |              tdate2=Nothing, | ||||||
|              tstatus=False, |              tstatus=False, | ||||||
| @ -384,7 +386,7 @@ journal7 = nulljournal {jtxns = | |||||||
|              tpreceding_comment_lines="" |              tpreceding_comment_lines="" | ||||||
|            } |            } | ||||||
|           , |           , | ||||||
|            txnTieKnot $ Transaction { |            txnTieKnot Transaction { | ||||||
|              tdate=parsedate "2007/01/03", |              tdate=parsedate "2007/01/03", | ||||||
|              tdate2=Nothing, |              tdate2=Nothing, | ||||||
|              tstatus=False, |              tstatus=False, | ||||||
| @ -399,7 +401,7 @@ journal7 = nulljournal {jtxns = | |||||||
|              tpreceding_comment_lines="" |              tpreceding_comment_lines="" | ||||||
|            } |            } | ||||||
|           , |           , | ||||||
|            txnTieKnot $ Transaction { |            txnTieKnot Transaction { | ||||||
|              tdate=parsedate "2007/01/03", |              tdate=parsedate "2007/01/03", | ||||||
|              tdate2=Nothing, |              tdate2=Nothing, | ||||||
|              tstatus=False, |              tstatus=False, | ||||||
| @ -414,7 +416,7 @@ journal7 = nulljournal {jtxns = | |||||||
|              tpreceding_comment_lines="" |              tpreceding_comment_lines="" | ||||||
|            } |            } | ||||||
|           , |           , | ||||||
|            txnTieKnot $ Transaction { |            txnTieKnot Transaction { | ||||||
|              tdate=parsedate "2007/01/03", |              tdate=parsedate "2007/01/03", | ||||||
|              tdate2=Nothing, |              tdate2=Nothing, | ||||||
|              tstatus=False, |              tstatus=False, | ||||||
| @ -431,4 +433,5 @@ journal7 = nulljournal {jtxns = | |||||||
|           ] |           ] | ||||||
|          } |          } | ||||||
| 
 | 
 | ||||||
|  | ledger7 :: Ledger | ||||||
| ledger7 = ledgerFromJournal Any journal7 | ledger7 = ledgerFromJournal Any journal7 | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ Print a histogram report. (The "activity" command). | |||||||
| 
 | 
 | ||||||
| module Hledger.Cli.Histogram | module Hledger.Cli.Histogram | ||||||
| where | where | ||||||
|  | 
 | ||||||
| import Data.List | import Data.List | ||||||
| import Data.Maybe | import Data.Maybe | ||||||
| import Data.Ord | import Data.Ord | ||||||
| @ -19,8 +20,8 @@ import Hledger.Query | |||||||
| import Prelude hiding (putStr) | import Prelude hiding (putStr) | ||||||
| import Hledger.Utils.UTF8IOCompat (putStr) | import Hledger.Utils.UTF8IOCompat (putStr) | ||||||
| 
 | 
 | ||||||
| 
 | activitymode :: Mode RawOpts | ||||||
| activitymode = (defCommandMode $ ["activity"] ++ aliases) { | activitymode = (defCommandMode $ ["activity"] : aliases) { | ||||||
|   modeHelp = "show an ascii barchart of posting counts per interval (default: daily)" `withAliases` aliases |   modeHelp = "show an ascii barchart of posting counts per interval (default: daily)" `withAliases` aliases | ||||||
|  ,modeHelpSuffix = [] |  ,modeHelpSuffix = [] | ||||||
|  ,modeGroupFlags = Group { |  ,modeGroupFlags = Group { | ||||||
| @ -31,6 +32,7 @@ activitymode = (defCommandMode $ ["activity"] ++ aliases) { | |||||||
|  } |  } | ||||||
|   where aliases = [] |   where aliases = [] | ||||||
| 
 | 
 | ||||||
|  | barchar :: Char | ||||||
| barchar = '*' | barchar = '*' | ||||||
| 
 | 
 | ||||||
| -- | Print a histogram of some statistic per reporting interval, such as | -- | Print a histogram of some statistic per reporting interval, such as | ||||||
| @ -46,8 +48,8 @@ showHistogram opts q j = concatMap (printDayWith countBar) spanps | |||||||
|       i = intervalFromOpts opts |       i = intervalFromOpts opts | ||||||
|       interval | i == NoInterval = Days 1 |       interval | i == NoInterval = Days 1 | ||||||
|                | otherwise = i |                | otherwise = i | ||||||
|       span = queryDateSpan (date2_ opts) q `spanDefaultsFrom` journalDateSpan (date2_ opts) j |       span' = queryDateSpan (date2_ opts) q `spanDefaultsFrom` journalDateSpan (date2_ opts) j | ||||||
|       spans = filter (DateSpan Nothing Nothing /=) $ splitSpan interval span |       spans = filter (DateSpan Nothing Nothing /=) $ splitSpan interval span' | ||||||
|       spanps = [(s, filter (isPostingInDateSpan s) ps) | s <- spans] |       spanps = [(s, filter (isPostingInDateSpan s) ps) | s <- spans] | ||||||
|       -- same as Register |       -- same as Register | ||||||
|       -- should count transactions, not postings ? |       -- should count transactions, not postings ? | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user