From fc243f2a54596bf6cfad2d6aa34f0c08411f5c03 Mon Sep 17 00:00:00 2001 From: dankito Date: Sat, 6 Nov 2021 02:00:44 +0100 Subject: [PATCH] Some transactions are twice or trice in database; fixed at least that they are not displayed anymore twice or trice in UI --- .../net/dankito/banking/ui/presenter/BankingPresenter.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt index 955af9e9..41fc4133 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt @@ -794,14 +794,14 @@ open class BankingPresenter( open fun searchAccountTransactions(query: String, transactions: List): List { val queryLowercase = query.trim().toLowerCase() - // get transactions sorted by date - val transactionsSorted = transactions.toSet().sortedByDate() + // get unique transactions sorted by date + val uniqueTransactionsSorted = transactions.toSet().sortedByDate() if (queryLowercase.isEmpty()) { - return transactionsSorted + return uniqueTransactionsSorted } - return transactionsSorted.filter { + return uniqueTransactionsSorted.filter { it.otherPartyName?.toLowerCase()?.contains(queryLowercase) == true || it.reference.toLowerCase().contains(queryLowercase) || it.bookingText?.toLowerCase()?.contains(queryLowercase) == true