Skip to content

Commit

Permalink
Merge pull request #786 from Vishwa-Raghavendra/develop
Browse files Browse the repository at this point in the history
Todo-Fix: CustomExchangeRate
  • Loading branch information
ILIYANGERMANOV committed Apr 25, 2022
2 parents 8a136ce + 69775af commit fcc55db
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,22 +232,20 @@ class EditTransactionViewModel @Inject constructor(

updateCurrency(account = selectedAccount)

//TODO: Fix that
// transaction.toAmount?.let {
// val exchangeRate = it / transaction.amount
// val toAccountCurrency =
// _accounts.value?.find { acc -> acc.id == transaction.toAccountId }?.currency
// _customExchangeRateState.value =
// _customExchangeRateState.value.copy(
// showCard = toAccountCurrency != account.value?.currency,
// exchangeRate = exchangeRate,
// convertedAmount = it,
// toCurrencyCode = toAccountCurrency,
// fromCurrencyCode = currency.value
// )
// } ?: let {
// _customExchangeRateState.value = CustomExchangeRateState()
// }
_customExchangeRateState.value = if (transaction.toAccountId == null)
CustomExchangeRateState()
else {
val exchangeRate = transaction.toAmount / transaction.amount
val toAccountCurrency =
_accounts.value.find { acc -> acc.id == transaction.toAccountId }?.currency
CustomExchangeRateState(
showCard = toAccountCurrency != account.value?.currency,
exchangeRate = exchangeRate.toDouble(),
convertedAmount = transaction.toAmount.toDouble(),
toCurrencyCode = toAccountCurrency,
fromCurrencyCode = currency.value
)
}

_displayLoanHelper.value = getDisplayLoanHelper(trans = transaction)
}
Expand Down

0 comments on commit fcc55db

Please sign in to comment.