Review Request 128061: Fix precision of split value

Allan Anderson agander93 at gmail.com
Fri Jun 3 11:21:41 UTC 2016



> On June 2, 2016, 1 p.m., Allan Anderson wrote:
> > This is not a good area for me, and takes me out of my comfort zone.
> > However, I've been having a look at this, and there are one or two points, which may or may not be relevant.
> > Firstly, the file attached to https://bugs.kde.org/show_bug.cgi?id=303026 does illustrate the problem.
> > Secondly, the sell transaction shows a missing assignment of "ACME 0.005".
> > Next, I edited it to remove the fee split, to simplify things a bit. It still shows the missing assignment.
> > Looking now at the void MyMoneyFile::fixSplitPrecision(MyMoneyTransaction& t) const routine, and specifically at the last line,
> > "(*its).setValue((*its).value().convertDenominator(fraction).canonicalize());"
> > For the first split, I get "16180.520000", but with the canonicalize() removed, I get "16180.525000".
> > The second split gives "-16180.525000".
> > Whether or not this is relevant, I really don't know and an expert opinion is needed, I think.

I think perhaps I should have mentioned that with MyMoneyFile::fixSplitPrecision() bypassed, this file imports correctly, and the same details may be entered manually with no error.
Also, I've just noticed that even where the transaction now shows no error, the consistency check reports that it has fixed the error.  This it does with
"if (t.splitSum().isZero()) {
            s.setShares(s.value());
    }"
Using similar code in MyMoneyFile::fixSplitPrecision() appears to resolve the problem in this bug.


- Allan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128061/#review96155
-----------------------------------------------------------


On May 30, 2016, 6:10 p.m., Thomas Baumgart wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128061/
> -----------------------------------------------------------
> 
> (Updated May 30, 2016, 6:10 p.m.)
> 
> 
> Review request for KMymoney.
> 
> 
> Bugs: 345655
>     http://bugs.kde.org/show_bug.cgi?id=345655
> 
> 
> Repository: kmymoney
> 
> 
> Description
> -------
> 
> The problem described in bug 345655 is caused by a fraction of the splits value that is larger than the fraction of the accounts currency. This leads to the effect, that values are displayed with correct value but the underlying value used for calculations is not equal to the amount displayed. This will end up in KMyMoney presenting the user strange messages like 'Unassigned value of 0.00' which do not make sense. The difference is in reality between 0 and 0.01, e.g. 0.008.
> 
> The attached patch resolves this problem by rounding the numbers to the correct fraction of the referrenced account.
> 
> 
> Diffs
> -----
> 
>   kmymoney/mymoney/mymoneyfile.h 0fd558b 
>   kmymoney/mymoney/mymoneyfile.cpp 568675c 
>   kmymoney/mymoney/mymoneyfiletest.h 657ed39 
>   kmymoney/mymoney/mymoneyfiletest.cpp 810b15f 
> 
> Diff: https://git.reviewboard.kde.org/r/128061/diff/
> 
> 
> Testing
> -------
> 
> Test case is part of the patch. It uses the values provided in the sample attached to the bug 345655 entry.
> 
> 
> Thanks,
> 
> Thomas Baumgart
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20160603/dd052ead/attachment-0001.html>


More information about the KMyMoney-devel mailing list