slight fix for --sort-amount, don't flip when normal balance unspecified

This commit is contained in:
Simon Michael 2017-09-25 19:10:21 -10:00
parent d9d92b3bf1
commit cd998e7f2f
2 changed files with 2 additions and 2 deletions

View File

@ -110,7 +110,7 @@ balanceReport opts q j = (items, total)
markboring = if no_elide_ opts then id else markBoringParentAccounts
maybesort = if sort_amount_ opts then sortBy (maybeflip $ comparing balance) else id
where
maybeflip = if normalbalance_ opts == Just NormalPositive then flip else id
maybeflip = if normalbalance_ opts == Just NormalNegative then id else flip
items = dbg1 "items" $ map (balanceReportItem opts q) accts'
total | not (flat_ opts) = dbg1 "total" $ sum [amt | (_,_,indent,amt) <- items, indent == 0]
| otherwise = dbg1 "total" $

View File

@ -186,7 +186,7 @@ multiBalanceReport opts q j = MultiBalanceReport (displayspans, items, totalsrow
where
-- reverse the sort if doing a balance report on normally-negative accounts,
-- so eg a large negative income balance appears at top in income statement
maybeflip = if normalbalance_ opts == Just NormalPositive then flip else id
maybeflip = if normalbalance_ opts == Just NormalNegative then id else flip
-- sort by average when that is displayed, instead of total.
-- Usually equivalent, but perhaps not in future (eg with --percent)
sortfield = if average_ opts then sixth6 else fifth6