Bug 473082

Summary: csv export of investment account uses 2 digits for number of shares and too many digits for price.
Product: [Applications] kmymoney Reporter: Jack <ostroffjh>
Component: exporterAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: gemdancer
Priority: NOR    
Version: 5.1.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.4

Description Jack 2023-08-06 23:25:39 UTC
Originally reported at https://discuss.kde.org/t/kmymoney-export-from-investment-truncates-shares-to-2-decimal-places/3523/4
Doing a csv export of an investment account truncates number of shares to 2 decimal places, no matter what is specified for that security, and the column for price uses too many decimal places (I didn't notice any particular pattern.)
I also tried to test in master branch, but there is a separate bug, in that no matter which account is chosen for export, it always exports the same account, which for me is the first Favorite Asset account.  I will file a separate bug or MR for that.
Comment 1 Thomas Baumgart 2023-08-08 06:24:13 UTC
Git commit f449d6bf9a1e221f8fddf3d6d147704bf1c0bce0 by Thomas Baumgart.
Committed on 08/08/2023 at 08:23.
Pushed by tbaumgart into branch 'master'.

Rework CSV Export dialog

The CSV export dialog was not working at all with the latest changes.

M  +226  -170  kmymoney/plugins/csv/export/csvexportdlg.cpp
M  +12   -73   kmymoney/plugins/csv/export/csvexportdlg.h
M  +33   -59   kmymoney/plugins/csv/export/csvexportdlg.ui
M  +0    -1    kmymoney/plugins/csv/export/csvexporter.cpp

https://invent.kde.org/office/kmymoney/-/commit/f449d6bf9a1e221f8fddf3d6d147704bf1c0bce0
Comment 2 Jack 2023-08-08 18:32:27 UTC
Master now segfaults for me clicking about anything in the csv export dialog.  Crash seems to be in one of the checkData functions depending on what I click.
Comment 3 Thomas Baumgart 2023-08-08 19:16:17 UTC
Is this an old version of the plugin? Just an idea.
Comment 4 Jack 2023-08-08 19:30:22 UTC
This is using the Gentoo generated build from master, just re-rebuilt) and no involvement of my compiled versions from git, which install (when I don't just run from the build dir) into their own locations, not on PATH.  It doesn't make any sense to me either.
Comment 5 Jack 2023-08-08 20:01:15 UTC
It seems pretty consistent about crashing on line 140 of csvexportdlg.cpp.  I've added some debug lines there, and they print correctly when called from the end of .CsvExportDlg::CsvExportDlg(QWidget* parent) but segfaults on that line when anthing else happens, even just clicking anywhere on the dialog and then clicking on the terminal running gdb.  I'm fearing this is beginning to smell like some local configuration problem, but I've got no real clue, nor idea on how to troubleshoot further.
Comment 6 Thomas Baumgart 2023-08-09 04:43:23 UTC
Git commit 314ece88391aff143842d870d94e1e14a0b7bce1 by Thomas Baumgart.
Committed on 09/08/2023 at 06:42.
Pushed by tbaumgart into branch 'master'.

Fix reported crash in CSV export dialog

M  +3    -0    kmymoney/plugins/csv/export/csvexportdlg.cpp

https://invent.kde.org/office/kmymoney/-/commit/314ece88391aff143842d870d94e1e14a0b7bce1
Comment 7 Jack 2023-08-09 16:46:01 UTC
Thanks.  I confirm that eliminates the crash.  Not sure why I didn't see that as the cause.
Comment 8 Thomas Baumgart 2023-08-09 16:50:00 UTC
Maybe, because it compiled w/o problems. It's a tricky thing to use the Qt style d-pointers inside lambdas. One must not forget to add the Q_D() macro inside the lambda even though it is present in the enclosing method.
Comment 9 Jack 2023-08-13 17:01:38 UTC
Git commit facd313630e12eae9c754fdb7f4b80e7b6a2a756 by Jack Ostroff.
Committed on 13/08/2023 at 19:00.
Pushed by ostroffjh into branch 'master'.

Improve precision of values in csv export

M  +29   -19   kmymoney/plugins/csv/export/csvwriter.cpp
M  +3    -2    kmymoney/plugins/csv/export/csvwriter.h

https://invent.kde.org/office/kmymoney/-/commit/facd313630e12eae9c754fdb7f4b80e7b6a2a756
Comment 10 Jack 2023-08-13 17:06:26 UTC
Git commit ea96006d67ce5b379465c3f0f0e3d1a90269407d by Jack Ostroff.
Committed on 13/08/2023 at 19:05.
Pushed by ostroffjh into branch '5.1'.

Improve precision of values in csv export.

M  +37   -25   kmymoney/plugins/csv/export/csvwriter.cpp
M  +3    -2    kmymoney/plugins/csv/export/csvwriter.h

https://invent.kde.org/office/kmymoney/-/commit/ea96006d67ce5b379465c3f0f0e3d1a90269407d
Comment 11 Thomas Baumgart 2023-10-30 20:41:33 UTC
*** Bug 448349 has been marked as a duplicate of this bug. ***
Comment 12 Jack 2023-11-08 00:24:12 UTC
Git commit 5057080335f40e3ef604a8fd129432a2c5101bb4 by Jack Ostroff.
Committed on 08/11/2023 at 01:22.
Pushed by ostroffjh into branch 'FixCSVExportQtyPrecision'.

Fix excess precision of quantity in csv export of investment accounts.

M  +2    -2    kmymoney/plugins/csv/export/csvwriter.cpp

https://invent.kde.org/office/kmymoney/-/commit/5057080335f40e3ef604a8fd129432a2c5101bb4