From 508ccfc7d25741d29b4137a1ca6f187f27d8c0f0 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 23 Jan 2024 21:50:30 -1000 Subject: [PATCH] imp: balance assertions error: show costs detail with --debug=2 --- hledger-lib/Hledger/Data/Balancing.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hledger-lib/Hledger/Data/Balancing.hs b/hledger-lib/Hledger/Data/Balancing.hs index b3f78e780..3bb7223f8 100644 --- a/hledger-lib/Hledger/Data/Balancing.hs +++ b/hledger-lib/Hledger/Data/Balancing.hs @@ -682,9 +682,12 @@ checkBalanceAssertionOneCommodityB p@Posting{paccount=assertedacct} assertedcomm acct -- asserted account (if istotal then "Across all commodities" else "In commodity " <> assertedcommstr) -- asserted commodity or all commodities ? (if isinclusive then "including subaccounts" else "excluding subaccounts" :: String) -- inclusive or exclusive balance asserted ? - (pad assertedstr) -- asserted amount, without cost - (pad actualstr) -- actual amount, without cost - -- <> " (with costs: " <> T.pack (showMixedAmountWith fmt actualcommbal) <> ")" -- debugging + (pad assertedstr -- asserted amount, without cost + <> if debugLevel >= 2 then " (with cost: " <> T.pack (showAmountWith fmt assertedcommbal) <> ")" else "" + ) + (pad actualstr -- actual amount, without cost + <> if debugLevel >= 2 then " (with costs: " <> T.pack (showMixedAmountWith fmt actualcommbal) <> ")" else "" + ) diffstr -- their difference (acct ++ if isinclusive then "" else "$") -- query matching the account(s) postings (if istotal then "" else (" cur:" ++ quoteForCommandLine (T.unpack assertedcomm))) -- query matching the commodity(ies)