stats: don't break on an empty file

This commit is contained in:
Simon Michael 2010-07-08 14:04:54 +00:00
parent fe12bd9c94
commit 7f8a352c0c
2 changed files with 7 additions and 2 deletions

View File

@ -72,7 +72,9 @@ showStats _ _ l today =
tnum7 = length $ filter withinlast7 ts
withinlast7 t = d >= addDays (-7) today && (d<=today) where d = tdate t
txnrate7 = fromIntegral tnum7 / 7 :: Double
acctnum = length $ accounts l
acctdepth = maximum $ map (accountNameLevel.aname) $ accounts l
acctnum = length as
acctdepth | null as = 0
| otherwise = maximum $ map (accountNameLevel.aname) as
as = accounts l
cs = Map.elems $ commodities l

View File

@ -0,0 +1,3 @@
bin/hledger -f- stats
<<<
>>> /Accounts.* 0 \(depth 0\)/