From 8673332c8eb90b92facb8492bc1b523bc88068b6 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 28 Aug 2015 11:58:57 -0700 Subject: [PATCH] ui, web: show fewer other accounts in acct register To reduce noise in the "other accounts" field of hledger-ui's and hledger-web's account register: if there are both real and virtual postings to other accounts, show only the accounts posted to by real postings. Use case: in many transactions I have extra balanced-virtual postings which adjust budget envelopes (subaccounts of checking). These clutter up the register's other accounts field making it useless. Excluding them (when there are also real postings) makes it more useful for me and probably others. --- hledger-lib/Hledger/Reports/TransactionsReports.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Reports/TransactionsReports.hs b/hledger-lib/Hledger/Reports/TransactionsReports.hs index cc1f72b22..888678550 100644 --- a/hledger-lib/Hledger/Reports/TransactionsReports.hs +++ b/hledger-lib/Hledger/Reports/TransactionsReports.hs @@ -201,8 +201,14 @@ accountTransactionsReportItems query thisacctquery bal signfn (torig:ts) = -- (froms,tos) = partition (fromMaybe False . isNegativeMixedAmount . pamount) ps -- | Generate a simplified summary of some postings' accounts. +-- To reduce noise, if there are both real and virtual postings, show only the real ones. summarisePostingAccounts :: [Posting] -> String -summarisePostingAccounts = intercalate ", " . map accountSummarisedName . nub . map paccount +summarisePostingAccounts ps = + (intercalate ", " . map accountSummarisedName . nub . map paccount) displayps + where + realps = filter isReal ps + displayps | null realps = ps + | otherwise = realps filterTransactionPostings :: Query -> Transaction -> Transaction filterTransactionPostings m t@Transaction{tpostings=ps} = t{tpostings=filter (m `matchesPosting`) ps}