From 0f081006ed15be8791559ef7f67a52124d971091 Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 1 Sep 2020 17:50:48 +0200 Subject: [PATCH] Filtering out potential remittees without IBAN --- .../persistence/CoreDataBankingPersistence.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift b/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift index 5ac85bac..5450aa7c 100644 --- a/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift +++ b/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift @@ -140,7 +140,9 @@ class CoreDataBankingPersistence: IBankingPersistence, IRemitteeSearcher { NSLog("Could not request Customers: \(error)") } - let remittees = transactions.map( { Remittee(name: $0.otherPartyName ?? "", iban: $0.otherPartyAccountId, bic: $0.otherPartyBankCode, bankName: nil) } ) + let remittees = transactions + .filter { $0.otherPartyAccountId != nil } // if IBAN is not set we cannot make use of it + .map( { Remittee(name: $0.otherPartyName ?? "", iban: $0.otherPartyAccountId, bic: $0.otherPartyBankCode, bankName: nil) } ) let uniqueRemittees = Set(remittees)