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
Fix bug 1187: Allow balance assertions with multiple posts to the same account #472
Conversation
Hi @mk12 Thank you very much for this first patch. It corrects the use case I described in PR #451 :-) However, my ledger file is still not passing. Here is another use case, when there are several commodities on the same account.
Is there something you can do? Maybe checking the commodity while computing the balance ? |
@thdox, is there a mistake in your example? Shouldn't the second assertion be positive 1524,49 €, not negative? I see what you mean though. Currently I am subtracting the amounts from previous postings to the same account in the same transaction without regard to commodities. I should change it to only subtract amounts of the same commodity as the current posting. I'll try to do this tonight or on the weekend. |
@mk12, yes, that should looks to something like:
I tried myself, based on your pull request, but this is much harder than I thought, I realized that I am not a c++ guy, and that I lack knowledge of the ledger's internals... |
3553859
to
d541cce
Compare
THANK YOU 👍@mk12, thank you so much, it does work on my ledger file now. FWIW, I did not tell that I tried to fix myself, and spend something like 6 hours with a lot more lines of codes, and time to compile, but without success. Sometimes Internet is beautiful. You made my day. |
@mk12, I want to echo Thierry's comments. Your work is very welcome! |
Glad to be of help :) @tbm, are you able to merge this? CI tests passed for gcc, and the clang failure seems be happening on the |
Thanks for merging 👍 |
Fixes Bug 1187
@thdox also discussed this in #451
Before, balance assertions/assignments just subtracted the amount in the current post. With these changes, they also subtract all amounts posted to the same account so far in the xact. I think anyone who wrote such a transaction would expect this behaviour.
I added two regression tests as well.