Bug 387040

Summary: Git commit c829ec79 broke investment price chart
Product: [Applications] kmymoney Reporter: David Houlden <djhoulden>
Component: reportsAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: ralf.habacker, simonandric5
Priority: NOR    
Version: 4.8.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 4.8.2
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 387280    
Attachments: Examply KMyMoney file
USD chart
GBP chart before commit
GBP chart after commit

Description David Houlden 2017-11-17 16:08:53 UTC
Created attachment 108918 [details]
Examply KMyMoney file

The latest commit to the 4.8 branch has broken one of my investment reports.

I have shares which are priced in USD and my base currency in KMyMoney is GBP. I produce two investment price charts for the shares showing the last year's price history. One shows the price history in USD, the other in GBP. This is achieved by ticking or unticking "Convert values to base currency" in the report configuration. 

After commit c829ec79 the GBP price history is not converting the price. The chart shows price history in USD. Attached is a KMyMoney file which can be used to show the problem, a screen print of the USD chart and prints of the GBP chart before and after the commit.
Comment 1 David Houlden 2017-11-17 16:09:53 UTC
Created attachment 108919 [details]
USD chart
Comment 2 David Houlden 2017-11-17 16:10:36 UTC
Created attachment 108920 [details]
GBP chart before commit
Comment 3 David Houlden 2017-11-17 16:11:05 UTC
Created attachment 108921 [details]
GBP chart after commit
Comment 4 Ralf Habacker 2017-11-28 00:11:56 UTC
Git commit 4cdb07aa56126988d575feef3d4a414ee67ff0df by Ralf Habacker.
Committed on 28/11/2017 at 00:11.
Pushed by habacker into branch '4.8'.

Fixed compile error in debug output of class PivotTable

The compiler error occurs when the DEBUG REPORTS macro is set.

M  +1    -1    kmymoney/reports/pivottable.cpp

https://commits.kde.org/kmymoney/4cdb07aa56126988d575feef3d4a414ee67ff0df
Comment 5 Ralf Habacker 2017-11-29 06:23:36 UTC
Just a side note: This seems to work only with daily reports. Choosing any other report date interval results into an empty diagram and report. The caterpillar is always zero. Combining this with bug 385857, which happens only in non daily reports, a possible solution would be to revert the commit which fixes bug 385857 and to state in the report configuration dialog that using "convert to base currency" is unreliable in non daily reports and should not be used yet until a proper fix is available. 

If one considers that the problem does not happen in daily reports, it would also be a strategy to always create the internal used report table (class PivotTable) with daily intervals and then merge the data at the requested date interval to use the HTML report or the Render diagram.
Comment 6 Ralf Habacker 2018-01-08 17:40:25 UTC
Git commit eed47fd1687c159ad4e02e84782398b7ecaef059 by Ralf Habacker.
Committed on 04/01/2018 at 09:21.
Pushed by habacker into branch '4.8'.

Fix 'Git commit c829ec79 broke investment price chart'

The fix is to revert commit "Fix 'Wrong Currency conversion
rate in Reports'" (c829ec79e0649c4b923a16f4154caa38ba72beeb)
required for bug 385857 for now.
Related: bug 385857
FIXED-IN:4.8.2

M  +50   -25   kmymoney/reports/pivottable.cpp
M  +4    -6    kmymoney/reports/pivottable.h
M  +1    -1    kmymoney/reports/pivottabletest.cpp

https://commits.kde.org/kmymoney/eed47fd1687c159ad4e02e84782398b7ecaef059