-
Notifications
You must be signed in to change notification settings - Fork 49
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
Balance calculation fails #5
Comments
Hi, thank you for your input, let me take a look, I will respond you in a few days. Basically, I confirm the issue with the test case; it is obviously about rounding. However, I cannot tell for sure which application manages this case less reasonable - I remember some examples when ledger rounding worked not so accurate as it was expected. Let me check, thank you! |
I would propose to work on the issue in a pair session via Skype. I am going to use this lib in my personal project and expecting to find out some more issues, so it would be very valuable to get some insight directly from you. |
Hi, it is likely you use another version of ledger that I used for porting: I see that your transaction fails for both nledger and ledger with exactly the same message: "Error: Only one posting with null amount allowed per transaction". My version of ledger version is 3.1.1; here is the output: dmitry@DESKTOP-A712KAM:~$ ledger dmitry@DESKTOP-A712KAM:~$ ledger bal -f /mnt/c/dev/dmvs/nledger/source/nledger.cli/bin/debug/issues-5.test NLedger produces the same: Currently, NLedger code is equal to ledger 3.1.1 branch NEXT commit fd486a59. Please, check ledger version on your side. So, I do not consider this issue to be a defect - nledger behaves exactly as its origin. However, if you use a newer version of ledger, I think it is a good time to consider an upgrade for NLedger codebase. Per quick look through ledger commits, I would say that it will take several weeks. Let me know if you are interested in it, it is not a big deal for me. In regards to the unit test example - I am not sure whether it is expected to work: your numbers are definitely differ, so that they never balance. I tried to imagine how to make it work (e.g. to play with commodities, precisions and flags) but did not fine any practical examples. If your code needs for something similar - I would recommend to create a ledger unit test with similar example - just to validate that ledger code can manage it. And, of course, any time you want to discuss any aspects of ledger/nledger code - you are welcome; just ping me by skype dmitry.merzlyakov. Thank you for your interest to this stuff! |
BTW, I created a test file for your case; you can find it in attach |
Yes, that is true, I am using a newer version, mine version is Ledger 3.1.3-20190331. |
Hi, I have an update in regards to this ticket:
The point is that this test shows the same behavior for both NLedger and the latest ledger - an attempt to read your transaction leads to the error: (The original ledger was built with the latest master sources on a fresh image of Ubuntu Server 19.10 following recommended steps). So, I do not see any discrepancies between ledger and NLedger so far; your transaction causes an expected error. If you do no think so, let's try the following steps:
Thank you! |
It is a really good work. Thanks! |
It's been a few years. Is this issue still valid? The error about empty values seems strange as all the postings have values. |
I think yes, this issue is still actual. There is a related test file - \Contrib\test\nledger\gh-issues-5.test; it reflects that the described transaction causes an error in NLedger:
I do not have the latest Ledger version handy, but I believe that 3.2.1-20200518 produced exactly the same error. It would be good to check what the latest version produces. If it is not an issue for it anymore - their fixing changes will be included into NLedger when I apply recent c++ code to NLedger. Anyway, it is not related to 29 because the latter is a mistake in .Net code. |
Initially I thought the issue was due to wrong display on GitHub, using HTML, so I downloaded the test file. I've just added the second space to separate the amounts from the account name and the result is the following
|
It looks like the syntax in that file is wrong. It is not a bug in Ledger or NLedger. |
The correct syntax for the Xact would be:
The test case |
I have a transaction that is fine in ledger:
2019/07/12 * box
55:assets:box -55 HUMMER @ 5372 EUR
55:expenses:delivery -1,700 EUR
55:expenses:delivery -13,818.44 EUR
55:assets:box 55 HUMMER @ 5,654.15345 EUR
but it fails with nledger
The root cause is that the balance of this transaction is visible as -0, and the IsZero property returns false.
I would be happy to assist to sort it out.
The text was updated successfully, but these errors were encountered: