Bug 498031 - Different sort order in the report on investment transactions
Summary: Different sort order in the report on investment transactions
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: reports (other bugs)
Version First Reported In: 5.1.90
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-29 17:43 UTC by Ralf Habacker
Modified: 2026-06-09 07:05 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.2
Sentry Crash Report:


Attachments
test file (11.64 KB, text/xml)
2024-12-29 17:43 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2024-12-29 17:43:40 UTC
Created attachment 176956 [details]
test file

STEPS TO REPRODUCE
1. inspect https://invent.kde.org/office/kmymoney/-/jobs/2415311#L2695

OBSERVED RESULT
On a Windows build, the csv export of the ‘Investment transactions (user-defined)’ report shows a different sort order for the ‘Interest income’ transaction, which is:

1 May 2022 [Split Transaction] BHP  IntIncome  0.00    100.00
           Transfer to Shares: BHP             0.00    0.00
           Interest                            0.00  100.00

while on Linux hosts the order is

1 May 2022 [Split Transaction] BHP  IntIncome  0.00    100.00
           Interest                            0.00  100.00
           Transfer to Shares: BHP             0.00    0.00

EXPECTED RESULT
For Windows builds, the order of the above lines should be the same as under Linux.

SOFTWARE/OS VERSIONS
detected on KDE CI
Comment 1 Thomas Baumgart 2024-12-30 13:15:32 UTC
Git commit fe70386176015e909db92971eea453a07f3adb22 by Thomas Baumgart.
Committed on 30/12/2024 at 13:14.
Pushed by tbaumgart into branch 'master'.

Fix sorting order

Apparently the result of std::sort() differs under Windows and Linux if
all sort criteria are identical. Adding the split ID as the last
criterion solves the problem.
FIXED-IN: 5.2

M  +1    -0    kmymoney/plugins/views/reports/core/listtable.h
M  +4    -1    kmymoney/plugins/views/reports/core/querytable.cpp

https://invent.kde.org/office/kmymoney/-/commit/fe70386176015e909db92971eea453a07f3adb22
Comment 2 Ralf Habacker 2026-06-09 07:05:58 UTC
Git commit dfb0045928b8dd86be6c156b1021597c2d966aca by Ralf Habacker.
Committed on 09/06/2026 at 06:59.
Pushed by habacker into branch 'master'.

Add additional report test cases

The test cases were derived from tickets reporting bugs
in the reporting engine and were added to monitor the
relevant functionality.
Related: bug 385993, bug 396301, bug 403825, bug 406403, bug 406525, bug 416274, bug 426241, bug 441023, bug 452096, bug 452692, bug 498033, bug 498054, bug 499180

M  +15   -0    kmymoney/plugins/views/reports/core/tests/data/CMakeLists.txt
A  +46   -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-385993-report-querytable-Investitionsentwicklung-nach-Typen-_angepasst_.csv
A  +6    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-396301-report-querytable-Investment-Capital-Gains-by-Account-_Customized---no-conversion_.csv
A  +6    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-396301-report-querytable-Investment-Capital-Gains-by-Account-_Customized_.csv
A  +6    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-396301-report-querytable-Investment-Performance-by-Account-_Customized_.csv
A  +22   -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-396301-report-querytable-Investment-Transactions-_Customized_.csv
A  +7    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-403825-report-querytable-Transactions-by-Account-_Customized_.csv
A  +4    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-403825-report-querytable-Transactions-by-Payee-_Customized_.csv
A  +12   -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-416274-report-querytable-Investment-Performance-by-Account-_12m_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-426241-report-querytable-Investment-Capital-Gains-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-426241-report-querytable-Investment-Holdings-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-426241-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year--start-later_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-426241-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-426241-report-querytable-Investment-Performance-by-Account-_Customized---from-period---three-year_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-426241-report-querytable-Investment-Performance-by-Account-_Customized---from-period---two-years_.csv
A  +27   -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-426241-report-querytable-Investment-Transactions-_Customized_.csv
A  +9    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-452096-report-querytable-Transactions-by-Category-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-452692-report-querytable-Investment-Performance-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-452692-report-querytable-Investment-Performance-by-Account-_From-Period_---one-year.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-452692-report-querytable-Investment-Performance-by-Account-_Only-Owned_---until-2024.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-452692-report-querytable-Investment-Performance-by-Account-_Only-Owned_-one-year.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-452692-report-querytable-Kopie-von-Investment-Performance-by-Account-_From-Period_---until-2024.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-497935-report-querytable-Investment-Capital-Gains-by-Account-_custom-report---only-owned_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-497935-report-querytable-Investment-Performance-by-Account-_custom-report---only-owned_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-497935-report-querytable-Investment-Performance-by-Account-_custom-report---only-sold_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-497935-report-querytable-Investment-Performance-by-Account-_custom-report---owned-and-sold_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-497935-report-querytable-Investment-Performance-by-Account-_custom-report---period_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498031-report-querytable-Investment-Capital-Gains-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498031-report-querytable-Investment-Holdings-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498031-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year--start-later_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498031-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498031-report-querytable-Investment-Performance-by-Account-_Customized---from-period---three-year_.csv
A  +27   -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498031-report-querytable-Investment-Transactions-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498033-report-querytable-Investment-Capital-Gains-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498033-report-querytable-Investment-Holdings-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498033-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year--start-later_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498033-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498033-report-querytable-Investment-Performance-by-Account-_Customized---from-period---three-year_.csv
A  +27   -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498033-report-querytable-Investment-Transactions-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498054-report-querytable-Investment-Capital-Gains-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498054-report-querytable-Investment-Holdings-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498054-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year--start-later_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498054-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-498054-report-querytable-Investment-Performance-by-Account-_Customized---from-period---three-year_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-499180-report-querytable-Investment-Capital-Gains-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-499180-report-querytable-Investment-Holdings-by-Account-_Customized_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-499180-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year--start-later_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-499180-report-querytable-Investment-Performance-by-Account-_Customized---from-period---one-year_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-499180-report-querytable-Investment-Performance-by-Account-_Customized---from-period---three-year_.csv
A  +5    -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-499180-report-querytable-Investment-Performance-by-Account-_Customized---from-period---two-years_.csv
A  +27   -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-499180-report-querytable-Investment-Transactions-_Customized_.csv
A  +16   -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-516585-convert-currency-report-querytable-Transactions-by-Account-_Base-converted_.csv
A  +17   -0    kmymoney/plugins/views/reports/core/tests/data/csv/test-516585-convert-currency-report-querytable-Transactions-by-Account-_Base-unconverted_.csv
A  +1744 -0    kmymoney/plugins/views/reports/core/tests/data/test-385993.xml
A  +145  -0    kmymoney/plugins/views/reports/core/tests/data/test-396301.xml
A  +76   -0    kmymoney/plugins/views/reports/core/tests/data/test-403825.xml
A  +85   -0    kmymoney/plugins/views/reports/core/tests/data/test-406403.xml
A  +87   -0    kmymoney/plugins/views/reports/core/tests/data/test-406525.xml
A  +145  -0    kmymoney/plugins/views/reports/core/tests/data/test-416274.xml
A  +154  -0    kmymoney/plugins/views/reports/core/tests/data/test-426241.xml
A  +288  -0    kmymoney/plugins/views/reports/core/tests/data/test-441023.xml
A  +76   -0    kmymoney/plugins/views/reports/core/tests/data/test-452096.xml
A  +201  -0    kmymoney/plugins/views/reports/core/tests/data/test-452692.xml
A  +106  -0    kmymoney/plugins/views/reports/core/tests/data/test-497935.xml
A  +151  -0    kmymoney/plugins/views/reports/core/tests/data/test-498031.xml
A  +151  -0    kmymoney/plugins/views/reports/core/tests/data/test-498033.xml
A  +148  -0    kmymoney/plugins/views/reports/core/tests/data/test-498054.xml
A  +154  -0    kmymoney/plugins/views/reports/core/tests/data/test-499180.xml
A  +151  -0    kmymoney/plugins/views/reports/core/tests/data/test-516585-convert-currency.xml

https://invent.kde.org/office/kmymoney/-/commit/dfb0045928b8dd86be6c156b1021597c2d966aca