From c8e4bc00987ecadeb8e3748d7ebb66cdc5fb009f Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 4 May 2017 10:24:00 -0700 Subject: [PATCH] bs/is: fix "Ratio has zero denominator" error with no matched accounts (#518) --- hledger/Hledger/Cli/Balance.hs | 2 +- hledger/Hledger/Cli/BalanceView.hs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hledger/Hledger/Cli/Balance.hs b/hledger/Hledger/Cli/Balance.hs index e3ad123b9..bcc69ea6a 100644 --- a/hledger/Hledger/Cli/Balance.hs +++ b/hledger/Hledger/Cli/Balance.hs @@ -532,7 +532,7 @@ balanceReportAsTable opts (MultiBalanceReport (colspans, items, (coltotals,tot,a | otherwise = (+----+ (row "" $ coltotals ++ (if row_total_ opts then [tot] else []) - ++ (if average_ opts then [avg] else []) + ++ (if average_ opts then [avg] else []) )) -- | Figure out the overall date span of a multicolumn balance report. diff --git a/hledger/Hledger/Cli/BalanceView.hs b/hledger/Hledger/Cli/BalanceView.hs index f39b22792..860968b63 100644 --- a/hledger/Hledger/Cli/BalanceView.hs +++ b/hledger/Hledger/Cli/BalanceView.hs @@ -137,8 +137,7 @@ balanceviewReport BalanceView{..} CliOpts{command_=cmd, reportopts_=ropts, rawop sumAmts = case amts of a1:as -> foldl' (zipWith (+)) a1 as [] -> [] - totavg = totsum `divideMixedAmount` - fromIntegral (length sumAmts) + totavg = totsum `divideMixedAmount` fromIntegral (length sumAmts) mergedTabl = case tabls of t1:ts -> foldl' merging t1 ts [] -> T.empty