-
-
Notifications
You must be signed in to change notification settings - Fork 342
fix: bal: fix commodity-column interaction with transpose and empty commodities #1654
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
Conversation
|
I haven't done a full read-through of the code here, but I think we shouldn't worry about conflicts between PRs for merging this: I can easily rebase. My bigger thought is that we seem to be jumping through a lot of hoops to work around the limitations of the table rendering code. If I understand correctly, the problem here is that we basically have two columns worth of row headers (account name, and commodity), while the rendering code can only handle one. So we are ad-doc throwing commodity columns in using purpose-designed functions. Would it be reasonable to solve this problem with a transpose option in the rendering code? Perhaps to add |
|
Thinking about it: you have a working implementation here. Let's work on merging this with the basic method used here. If we come up with a simpler way later, we can do the refactoring then and make sure it still passes all these tests. |
That is certainly one way to approach it. Are you imagining a situation where Either way we would also need to implement the header-column independence for the budget report that we talked about #1626 (comment) (Which might indicate a compelling use case). Budget was also the most annoying piece of code to change so I'm open to improvements there...
Sounds good to me. Would it be helpful if I split this into separate PRs for empty-commodity handling fixes and transpose-flag fixes? |
c986bd9 to
5fea31e
Compare
That would keep the commit history cleaner, but it's not crucial. This PR seems to include enabling |
I didn't touch the format specifier or any of the aggressive account name elisions so not completely covered. (The CSV and HTML output changes in the compound reports is handled by this and not 1649 though) |
|
In that case, I'll mark #1649 as draft and wait until this one is merged before deciding what in there is still useful. |
|
This build failure seems to be unrelated to the content of the PR. |
Pushed a fix that might help. |
|
...to master; if this PR gets rebased its CI may work again. |
5fea31e to
5290ece
Compare
We can't filter out empty commodity strings since that is a legitimate group. Simultaneously, we should only include the empty commodity if it is explicitly used (part of a posting) and not generated as part of `Amounts.amounts`
The textual output needs to be fully transposed instead of just the cell values. The multi-period csv handling code already does the right thing so just use those values. The change in CompoundBalanceCommand.hs is just to match signatures since commodity-column is not yet enabled there.
Budget formatting is quite complicated since we must determine widths for each of the transposed columns
Also renames the file for consistent naming with the flag
5290ece to
47b7f2d
Compare
|
Thanks for the followup testing and fixes! |
We can't filter out empty commodity strings since that is a legitimate group. Simultaneously, we should only include the empty commodity if it is explicitly used (part of a posting) and not generated as part of `Amounts.amounts`
The textual output needs to be fully transposed instead of just the cell values. The multi-period csv handling code already does the right thing so just use those values. The change in CompoundBalanceCommand.hs is just to match signatures since commodity-column is not yet enabled there.
Budget formatting is quite complicated since we must determine widths for each of the transposed columns
Also renames the file for consistent naming with the flag
I was introducing
--commodity-columninto my personal reports and realized that the textual output didn't correctly handle--transposewhen both flags are set. While fixing that, I also realized that empty commodities were being silently filtered out (e.g https://github.com/simonmichael/hledger/blob/master/hledger/Hledger/Cli/Commands/Balance.hs#L717). This wasn't a regression per-se but obviously undesirable behavior.There is some overlap with #1649 since handling transposition unfortunately involved some reworking of the compound call-site.
Perhaps the suite of flag interactions should be more formally considered?