Bug 498031

Summary: Different sort order in the report on investment transactions
Product: [Applications] kmymoney Reporter: Ralf Habacker <ralf.habacker>
Component: reportsAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 5.1.90   
Target Milestone: ---   
Platform: Other   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 5.2
Sentry Crash Report:
Attachments: test file

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