Fixed that for single selected bank accounts all account's account transactions have been displayed (instead of only that ones for that single account)

This commit is contained in:
dankito 2020-04-22 20:17:47 +02:00
parent 8eae569d69
commit 563afba3bc
1 changed files with 4 additions and 4 deletions

View File

@ -310,7 +310,7 @@ open class BankingPresenter(
get() = ArrayList(selectedBankAccountsField) get() = ArrayList(selectedBankAccountsField)
open val selectedBankAccountsAccountTransactions: List<AccountTransaction> open val selectedBankAccountsAccountTransactions: List<AccountTransaction>
get() = getAccountTransactionsForAccounts(selectedBankAccounts.map { it.account }.toSet()) get() = getAccountTransactionsForBankAccounts(selectedBankAccounts)
open val balanceOfSelectedBankAccounts: BigDecimal open val balanceOfSelectedBankAccounts: BigDecimal
get() = sumBalance(selectedBankAccounts.map { it.balance }) get() = sumBalance(selectedBankAccounts.map { it.balance })
@ -341,7 +341,7 @@ open class BankingPresenter(
get() = accounts.flatMap { it.bankAccounts } get() = accounts.flatMap { it.bankAccounts }
open val allTransactions: List<AccountTransaction> open val allTransactions: List<AccountTransaction>
get() = getAccountTransactionsForAccounts(accounts) get() = getAccountTransactionsForBankAccounts(bankAccounts)
open val balanceOfAllAccounts: BigDecimal open val balanceOfAllAccounts: BigDecimal
get() = getBalanceForAccounts(accounts) get() = getBalanceForAccounts(accounts)
@ -389,8 +389,8 @@ open class BankingPresenter(
} }
protected open fun getAccountTransactionsForAccounts(accounts: Collection<Account>): List<AccountTransaction> { protected open fun getAccountTransactionsForBankAccounts(bankAccounts: Collection<BankAccount>): List<AccountTransaction> {
return accounts.flatMap { it.transactions }.sortedByDescending { it.bookingDate } // TODO: someday add unbooked transactions return bankAccounts.flatMap { it.bookedTransactions }.sortedByDescending { it.bookingDate } // TODO: someday add unbooked transactions
} }
protected open fun getBalanceForAccounts(accounts: Collection<Account>): BigDecimal { protected open fun getBalanceForAccounts(accounts: Collection<Account>): BigDecimal {