Skip to content

Commit

Permalink
[transaction] use foreign amount for new local amount if it was empty
Browse files Browse the repository at this point in the history
fix #201
  • Loading branch information
dreautall committed Dec 30, 2023
1 parent 5cb79b2 commit b41ca53
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/pages/transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1280,10 +1280,18 @@ class _TransactionPageState extends State<TransactionPage>
for (int i = 0; i < _foreignCurrencies.length; i++) {
if (newCurrency.id == _localCurrency!.id) {
_foreignCurrencies[i] = null;
log.finest(() =>
"before: foreignAmounts[i] = ${_foreignAmounts[i]}, localAmounts[i] = ${_localAmounts[i]}");
if (_foreignAmounts[i] != 0 &&
_localAmounts[i] == 0) {
_localAmounts[i] = _foreignAmounts[i];
}
log.finest(() =>
"after: foreignAmounts[i] = ${_foreignAmounts[i]}, localAmounts[i] = ${_localAmounts[i]}");
} else {
_foreignCurrencies[i] = newCurrency;
log.finest(() =>
"foreignAmounts[i] = ${_foreignAmounts[i]}, localAmounts[i] = ${_localAmounts[i]}");
"before: foreignAmounts[i] = ${_foreignAmounts[i]}, localAmounts[i] = ${_localAmounts[i]}");
if (_foreignAmounts[i] == 0) {
_foreignAmounts[i] = _localAmounts[i];
if (_foreignAmounts[i] != 0) {
Expand All @@ -1295,6 +1303,8 @@ class _TransactionPageState extends State<TransactionPage>
2);
}
}
log.finest(() =>
"after: foreignAmounts[i] = ${_foreignAmounts[i]}, localAmounts[i] = ${_localAmounts[i]}");
}
}
});
Expand Down

0 comments on commit b41ca53

Please sign in to comment.