Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hledger-web --empty show 0 accounts if conversion exists #2140

Closed
chaoxu opened this issue Dec 18, 2023 · 7 comments
Closed

hledger-web --empty show 0 accounts if conversion exists #2140

chaoxu opened this issue Dec 18, 2023 · 7 comments
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. docs Documentation-related. impact4 Affects more than a few users. severity2 Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate. web The hledger-web tool.

Comments

@chaoxu
Copy link

chaoxu commented Dec 18, 2023

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:

image

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

@chaoxu chaoxu added the A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. label Dec 18, 2023
@simonmichael
Copy link
Owner

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).

@chaoxu
Copy link
Author

chaoxu commented Dec 19, 2023

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.

@simonmichael
Copy link
Owner

simonmichael commented Dec 19, 2023

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 ?

@simonmichael simonmichael added the web The hledger-web tool. label Dec 19, 2023
@simonmichael
Copy link
Owner

(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.)

@simonmichael simonmichael added impact4 Affects more than a few users. severity2 Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate. labels Jan 28, 2024
@simonmichael
Copy link
Owner

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:

image

But I suppose that would be too disruptive, eg for people with many priced lots the sidebar will become very long ?

@simonmichael
Copy link
Owner

simonmichael commented Mar 2, 2024

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

  1. make it show zeros with their commodity symbol, which is slightly more informative, and
  2. document how some zeros in hledger-web are not actually zeros, just appearing that way because it doesn't show costs

@simonmichael simonmichael added the docs Documentation-related. label Mar 2, 2024
simonmichael added a commit that referenced this issue Mar 2, 2024
This was mainly to make the sidebar more informative,
but also affects and hopefully helps, all amounts displayed elsewhere.
@simonmichael
Copy link
Owner

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.

adept pushed a commit to adept/hledger that referenced this issue Mar 8, 2024
…ael#2140]

This was mainly to make the sidebar more informative,
but also affects and hopefully helps, all amounts displayed elsewhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. docs Documentation-related. impact4 Affects more than a few users. severity2 Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate. web The hledger-web tool.
Projects
None yet
Development

No branches or pull requests

2 participants