From e4c5e5ccfc653413b20ce25d5d5dac5f77bae633 Mon Sep 17 00:00:00 2001 From: dankito Date: Sat, 31 Aug 2024 16:37:19 +0200 Subject: [PATCH] Fixed displaying reference --- .../net/codinux/banking/dataaccess/SqliteBankingRepository.kt | 1 + .../net/codinux/banking/ui/model/AccountTransactionViewModel.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt index 7c2e8ac..53a644b 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt @@ -99,6 +99,7 @@ open class SqliteBankingRepository( override fun getAllAccountTransactionsAsViewModel(): List = + // TODO: find a better way to express the reference value to display, sepaReference or (unparsed)reference accountTransactionQueries.selectAllTransactionsAsViewModel { id, userAccountId, bankAccountId, amount, currency, reference, valueDate, otherPartyName, bookingText, sepaReference, userSetDisplayName, category -> AccountTransactionViewModel(id, userAccountId, bankAccountId, mapToAmount(amount), currency, sepaReference ?: reference, mapToDate(valueDate), otherPartyName, bookingText, userSetDisplayName, category) }.executeAsList() diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/model/AccountTransactionViewModel.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/model/AccountTransactionViewModel.kt index 1b0111c..3161f48 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/model/AccountTransactionViewModel.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/model/AccountTransactionViewModel.kt @@ -23,5 +23,5 @@ data class AccountTransactionViewModel( constructor(entity: AccountTransactionEntity) : this(entity.id, entity.userAccountId, entity.bankAccountId, entity) constructor(id: Long, userAccountId: Long, bankAccountId: Long, transaction: AccountTransaction) - : this(id, userAccountId, bankAccountId, transaction.amount, transaction.currency, transaction.reference, transaction.valueDate, transaction.otherPartyName, transaction.bookingText) + : this(id, userAccountId, bankAccountId, transaction.amount, transaction.currency, transaction.sepaReference ?: transaction.reference, transaction.valueDate, transaction.otherPartyName, transaction.bookingText) }