diff --git a/MMEX/Repositories/TransactionRepository.swift b/MMEX/Repositories/TransactionRepository.swift index 24a79e5..b7556f5 100644 --- a/MMEX/Repositories/TransactionRepository.swift +++ b/MMEX/Repositories/TransactionRepository.swift @@ -144,23 +144,18 @@ extension TransactionRepository { startDate: Date? = Calendar.current.date(byAdding: .month, value: -3, to: Date()), endDate: Date? = Date() ) -> [TransactionData] { + var table = Self.repositoryTable - var filter = Expression(value: true) - + if let accountId { + table = table.filter(Self.col_accountId == accountId || Self.col_toAccountId == accountId) + } if let startDate { - filter = filter && (Self.col_transDate >= startDate.ISO8601Format()) + table = table.filter(Self.col_transDate >= startDate.ISO8601Format()) } - //if let endDate { - // filter = filter && (Self.col_transDate <= endDate.ISO8601Format()) + // table = table.filter(Self.col_transDate <= endDate.ISO8601Format()) //} - if let accountId { - filter = filter && ((Self.col_accountId == accountId) || (Self.col_toAccountId == accountId)) - } - - let table = Self.repositoryTable.filter(filter) - return selectData(from: table) } }