mtotschnig / MyExpenses

GPL licenced Android Expense Tracking App
http://www.myexpenses.mobi/
GNU General Public License v3.0
777 stars 211 forks source link

[bug] Transfer origin/destination swap when template value changed to 0 #1411

Open spencerkoo opened 5 months ago

spencerkoo commented 5 months ago

Specs:

EDIT: I found the reason

IGNORE BELOW, but leaving my original notes for context around cases when this was happening.

Steps to recreate:

When this does not occur:

mtotschnig commented 5 months ago

The reason behind this behavior is that when you swap the origin and destination, in the background My Expenses actually does not swap anything, but changes the sign of the amount, which works when the amount is non-zero, because transferring a negative amount from A to B is equivalent with transferring this amount from B to A. But when the value is 0, this concept breaks. To solve this some non-trivial refactoring is needed.

spencerkoo commented 5 months ago

That makes sense. Appreciate the extra context around why the behavior happens.