From 0df3a4714f4afe03e26bf53e2edffa7e0acee123 Mon Sep 17 00:00:00 2001 From: Stephen Morgan Date: Sat, 12 Jun 2021 11:45:40 +1000 Subject: [PATCH] lib: When performing a summary posting report without depth limiting, report exclusive balances rather than inclusive balances (#1568). --- hledger-lib/Hledger/Reports/PostingsReport.hs | 2 +- hledger/test/register/intervals.test | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Hledger/Reports/PostingsReport.hs b/hledger-lib/Hledger/Reports/PostingsReport.hs index cefa47298..582b85710 100644 --- a/hledger-lib/Hledger/Reports/PostingsReport.hs +++ b/hledger-lib/Hledger/Reports/PostingsReport.hs @@ -212,7 +212,7 @@ summarisePostingsInDateSpan (DateSpan b e) wd mdepth showempty ps balance a = maybe nullmixedamt bal $ lookupAccount a accts where bal = if isclipped a then aibalance else aebalance - isclipped a = maybe True (accountNameLevel a >=) mdepth + isclipped a = maybe False (accountNameLevel a >=) mdepth negatePostingAmount :: Posting -> Posting negatePostingAmount = postingTransformAmount negate diff --git a/hledger/test/register/intervals.test b/hledger/test/register/intervals.test index 962383678..e1e0b7481 100644 --- a/hledger/test/register/intervals.test +++ b/hledger/test/register/intervals.test @@ -1,10 +1,12 @@ # 1. monthly reporting interval, no end dates, shows just the intervals with data: < 2011/2/1 - (a) 1 + (a) 1 + (a:b) 1 $ hledger -f- register --period 'monthly' 2011-02 a 1 1 + a:b 1 2 # 2. or with a query pattern, just the intervals with matched data: <