Bug 435512 - When matching an assigned and unassigned transaction, KMM may leave the resulting category empty
Summary: When matching an assigned and unassigned transaction, KMM may leave the resul...
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.1.1
Platform: Other Other
: NOR normal (vote)
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-08 15:42 UTC by Dawid Wróbel
Modified: 2021-09-15 07:00 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.1.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Wróbel 2021-04-08 15:42:13 UTC
SUMMARY
When matching two transactions, one assigned to its category and othe ther not, the order of clicking on them determines whether the resulting transaction will retain the original category or not.


STEPS TO REPRODUCE
1. Find two transactions with matching amount, one with assigned category, the other not
2. Select the transaction with assigned category
3. Add the transaction with unsigned category to selection

OBSERVED RESULT
Notice that the suggested resulting category is unassigned. Now, if you reverse the order of selection, the category suggested is the one of the selected transaction that originally had it assigned.  


EXPECTED RESULT
The category should remain no matter the order of selection.
Comment 1 Dawid Wróbel 2021-04-08 16:02:18 UTC
Actually, my bad: you actually have to select the assigned first, and then the unassigned transaction for the match to work as expected. The other way round is broken. 

This is because TransactionMatcher::match() uses the first transaction selected as a base.
Comment 2 Thomas Baumgart 2021-04-17 09:27:44 UTC
Git commit 2526004d3ff6f80f014102fe76244190f5c44d7f by Thomas Baumgart.
Committed on 17/04/2021 at 09:27.
Pushed by tbaumgart into branch 'improve_merging'.

Improve transaction merging

Transaction merging does not provide any visual feedback to the user.
This can lead to unwanted results. This mostly happeqns, when the user
selected transactions appear in an unexpected order to the matching
function and the category assignment disappears for no obvious reason.

The logic has been enhanced to check if an imported transaction which
usually does not have a category assigned shall replace an existing
transaction that has a category assignment. In this case, the selected
transactions are exchanged so that the category assignment does not
disappear. In case both transactions have more than one split, the user
is asked for confirmation of the operation.
FIXED-IN: 5.1.2

M  +1    -1    kmymoney/dialogs/kmergetransactionsdlg.cpp
M  +56   -53   kmymoney/views/kgloballedgerview_p.h

https://invent.kde.org/office/kmymoney/commit/2526004d3ff6f80f014102fe76244190f5c44d7f
Comment 3 Thomas Baumgart 2021-04-23 05:25:34 UTC
Git commit 49e4e13a546a5b6bdfbbbcef65bdb59cc54ae4ab by Thomas Baumgart.
Committed on 23/04/2021 at 05:25.
Pushed by tbaumgart into branch '5.1'.

Improve transaction merging

Transaction merging does not provide any visual feedback to the user.
This can lead to unwanted results. This mostly happeqns, when the user
selected transactions appear in an unexpected order to the matching
function and the category assignment disappears for no obvious reason.

The logic has been enhanced to check if an imported transaction which
usually does not have a category assigned shall replace an existing
transaction that has a category assignment. In this case, the selected
transactions are exchanged so that the category assignment does not
disappear. In case both transactions have more than one split, the user
is asked for confirmation of the operation.
FIXED-IN: 5.1.2

M  +5    -1    kmymoney/dialogs/kmergetransactionsdlg.cpp
M  +56   -53   kmymoney/views/kgloballedgerview_p.h

https://invent.kde.org/office/kmymoney/commit/49e4e13a546a5b6bdfbbbcef65bdb59cc54ae4ab
Comment 4 Thomas Baumgart 2021-04-23 15:32:06 UTC
Git commit 02e3797990c5451b8ee7ecf094cc76c62f0d3cf6 by Thomas Baumgart.
Committed on 23/04/2021 at 15:30.
Pushed by tbaumgart into branch 'master'.

Improve transaction merging

Transaction merging does not provide any visual feedback to the user.
This can lead to unwanted results. This mostly happeqns, when the user
selected transactions appear in an unexpected order to the matching
function and the category assignment disappears for no obvious reason.

The logic has been enhanced to check if an imported transaction which
usually does not have a category assigned shall replace an existing
transaction that has a category assignment. In this case, the selected
transactions are exchanged so that the category assignment does not
disappear. In case both transactions have more than one split, the user
is asked for confirmation of the operation.
FIXED-IN: 5.1.2

(cherry picked from commit 49e4e13a546a5b6bdfbbbcef65bdb59cc54ae4ab)

M  +5    -1    kmymoney/oldregister/kmergetransactionsdlg.cpp
M  +55   -52   kmymoney/views/kgloballedgerview_p.h

https://invent.kde.org/office/kmymoney/commit/02e3797990c5451b8ee7ecf094cc76c62f0d3cf6