Fixed displaying reference

This commit is contained in:
dankito 2024-08-31 16:37:19 +02:00
parent 15177ed2ef
commit e4c5e5ccfc
2 changed files with 2 additions and 1 deletions

View File

@ -99,6 +99,7 @@ open class SqliteBankingRepository(
override fun getAllAccountTransactionsAsViewModel(): List<AccountTransactionViewModel> = override fun getAllAccountTransactionsAsViewModel(): List<AccountTransactionViewModel> =
// 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 -> 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) AccountTransactionViewModel(id, userAccountId, bankAccountId, mapToAmount(amount), currency, sepaReference ?: reference, mapToDate(valueDate), otherPartyName, bookingText, userSetDisplayName, category)
}.executeAsList() }.executeAsList()

View File

@ -23,5 +23,5 @@ data class AccountTransactionViewModel(
constructor(entity: AccountTransactionEntity) : this(entity.id, entity.userAccountId, entity.bankAccountId, entity) constructor(entity: AccountTransactionEntity) : this(entity.id, entity.userAccountId, entity.bankAccountId, entity)
constructor(id: Long, userAccountId: Long, bankAccountId: Long, transaction: AccountTransaction) 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)
} }