From df424a7a965fad1986e9cf4949842f77b3f451e2 Mon Sep 17 00:00:00 2001 From: Stephen Morgan Date: Sat, 11 Sep 2021 11:26:14 +1000 Subject: [PATCH] fix: web: Do not hide empty accounts if they have non-empty subaccounts. (#1237) --- hledger-web/Hledger/Web/Widget/Common.hs | 2 ++ hledger-web/templates/balance-report.hamlet | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hledger-web/Hledger/Web/Widget/Common.hs b/hledger-web/Hledger/Web/Widget/Common.hs index 734ec8453..9c1192cca 100644 --- a/hledger-web/Hledger/Web/Widget/Common.hs +++ b/hledger-web/Hledger/Web/Widget/Common.hs @@ -84,6 +84,8 @@ balanceReportAsHtml (journalR, registerR) here hideEmpty j q qopts (items, total l = ledgerFromJournal Any j indent a = preEscapedString $ concat $ replicate (2 + 2 * a) " " hasSubAccounts acct = maybe True (not . null . asubs) (ledgerAccount l acct) + isInterestingAccount acct = maybe False isInteresting $ ledgerAccount l acct + where isInteresting a = not (mixedAmountLooksZero (aebalance a)) || any isInteresting (asubs a) matchesAcctSelector acct = Just True == ((`matchesAccount` acct) <$> inAccountQuery qopts) accountQuery :: AccountName -> Text diff --git a/hledger-web/templates/balance-report.hamlet b/hledger-web/templates/balance-report.hamlet index dcc916665..e27598722 100644 --- a/hledger-web/templates/balance-report.hamlet +++ b/hledger-web/templates/balance-report.hamlet @@ -7,8 +7,8 @@ $forall (acct, adisplay, aindent, abal) <- items - + :hideEmpty && not (isInterestingAccount acct):.hide> +
\#{indent aindent}