hledger-web --empty show 0 accounts if conversion exists
Here is the simplest example:
2022-01-01 test
assets:1 1 UNIT @ 1 USD
assets:2
2022-01-02 test
assets:1 -1 UNIT
assets:3
The output:
For both hledger-web -E and hledger-web, the output is the same:
Expected output:
Just like the above picture, but assets:1 account should not appear at all in hledger-web -E, as it is now empty.
Related explorations
I've tested it in hledger, which is working correctly.
Note in hledger, -E shows 0 account, but in hledger-web, -E hides 0 accounts.
hledger bal
-1 USD assets:2
1 UNIT assets:3
--------------------
1 UNIT
-1 USD
hledger bal -E
0 assets:1
-1 USD assets:2
1 UNIT assets:3
--------------------
1 UNIT
-1 USD
The version: hledger-web 1.32.1, mac-aarch64
Yes, -E/--empty in hledger-web and hledger-ui works oppositely from hledger (hledger hides empty/zero things by default, hledger-ui/hledger-web show them by default).
Thanks.
Just to be clear, the -E working opposite is expected.
What is not expected is that -E is not working correctly for hledger-web. As the example shows turning it on or not does not change the output.
I don't really have a clear understanding of how hledger-web reacts to -E and how much of a bug there is here. Is it possible to reproduce with simpler data, eg without costs or currencies ?
(I suspect hledger-web intentionally never hides zero-balance accounts, to minimise confusion. We should check the code and if that's so, clarify the docs.)
Hello @chaoxu, I looked into this and I see what you mean. It is always showing "0" for assets:1 because it's not really zero at all, it only appears to be when costs are ignored.
If we showed costs in the sidebar, it would look like this:
But I suppose that would be too disruptive, eg for people with many priced lots the sidebar will become very long ?
Yes, too disruptive if we show costs in the sidebar. (Current hledger-web doesn't show costs anywhere in fact.)
For now I am inclined to
- make it show zeros with their commodity symbol, which is slightly more informative, and
- document how some zeros in hledger-web are not actually zeros, just appearing that way because it doesn't show costs
I made the change in master and updated the hledger-web manual (see end of https://hledger.org/dev/hledger-web.html#options). I think this issue can be closed for now.