imp: drop the "a difference of ..." line from balance assertion errors

Rationale:
To satisfy the recentassertions check I'm often filling in a bunch of
placeholder balance assertions, copy/pasting the correct amount from
the balance assertion failure messages. In this situation the
difference just repeats the amount in the line above, with opposite
sign, which makes it harder for me to interpret the message and to
copy-paste the right amount. And more generally I think showing the
difference isn't really necessary.
This commit is contained in:
Simon Michael 2023-12-06 17:55:38 -10:00
parent 1d29540a53
commit 6a41ed9e64
4 changed files with 3 additions and 6 deletions

View File

@ -664,7 +664,6 @@ checkBalanceAssertionOneCommodityB p@Posting{paccount=assertedacct} assertedamt
-- "display precision: %d",
"this balance was asserted: %s", -- (at display precision: %s)",
"but the calculated balance is: %s", -- (at display precision: %s)",
"a difference of: %s",
"",
"To troubleshoot, you can view this account's running balance. Eg:",
"",
@ -680,7 +679,7 @@ checkBalanceAssertionOneCommodityB p@Posting{paccount=assertedacct} assertedamt
-- (showAmount assertedamt)
(show $ aquantity actualbalincomm)
-- (showAmount actualbalincommodity)
(show $ aquantity assertedamt - aquantity actualbalincomm)
-- (show $ aquantity assertedamt - aquantity actualbalincomm)
(acct ++ if isinclusive then "" else "$")
(if istotal then "" else (" cur:" ++ quoteForCommandLine (T.unpack assertedcomm)))
where

View File

@ -186,7 +186,6 @@ In account: a
and commodity:
this balance was asserted: 1
but the calculated balance is: 0
a difference of: 1
To troubleshoot, you can view this account's running balance. Eg:

View File

@ -11,6 +11,5 @@ In account: a
and commodity:
this balance was asserted: 1
but the calculated balance is: 0
a difference of: 1
/
>= 1

View File

@ -398,7 +398,7 @@ commodity $1000.00
(a) $1.00 = $1.01
$ hledger -f- print
>2 /a difference of.*0\.004/
>2 /balance assertion failed/
>=1
# ** 25. This fails
@ -412,7 +412,7 @@ commodity $1000.00
(a) $1.00 = $1.0061
$ hledger -f- print
>2 /a difference of.*0\.0001/
>2 /balance assertion failed/
>=1
# ** 26. Inclusive assertions include balances from subaccounts.