fix: web: Do not hide empty accounts if they have non-empty subaccounts. (#1237)

This commit is contained in:
Stephen Morgan 2021-09-11 11:26:14 +10:00 committed by Simon Michael
parent 36f5bc9d23
commit df424a7a96
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -7,8 +7,8 @@
$forall (acct, adisplay, aindent, abal) <- items
<tr
:matchesAcctSelector acct:.inacct
:mixedAmountLooksZero abal && hideEmpty:.hide>
<td .acct :mixedAmountLooksZero abal:.empty>
:hideEmpty && not (isInterestingAccount acct):.hide>
<td .acct :not (isInterestingAccount acct):.empty>
<div .ff-wrapper>
\#{indent aindent}
<a.acct-name href="@?{(registerR, [("q", replaceInacct q $ accountQuery acct)])}"