From a7063f7a5d70a123a7aac5d7d74fb1d55a626287 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 21 Sep 2017 18:14:37 -0700 Subject: [PATCH] Simplify filterIncomingArticles. --- Frameworks/Database/ArticlesTable.swift | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Frameworks/Database/ArticlesTable.swift b/Frameworks/Database/ArticlesTable.swift index 25ca0f0e3..3be8c1e60 100644 --- a/Frameworks/Database/ArticlesTable.swift +++ b/Frameworks/Database/ArticlesTable.swift @@ -107,7 +107,7 @@ final class ArticlesTable: DatabaseTable { return } - let incomingArticles = self.filterIncomingArticles(allIncomingArticles, statusesDictionary) //3 + let incomingArticles = self.filterIncomingArticles(allIncomingArticles) //3 if incomingArticles.isEmpty { self.callUpdateArticlesCompletionBlock(nil, nil, completion) return @@ -431,18 +431,11 @@ private extension ArticlesTable { return status.dateArrived < maximumArticleCutoffDate } - func filterIncomingArticles(_ articles: Set
, _ statuses: [String: ArticleStatus]) -> Set
{ + func filterIncomingArticles(_ articles: Set
) -> Set
{ // Drop Articles that we can ignore. - return Set(articles.filter{ (article) -> Bool in - let articleID = article.articleID - if let status = statuses[articleID] { - return !statusIndicatesArticleIsIgnorable(status) - } - assertionFailure("Expected a status for each Article.") - return true - }) + return Set(articles.filter{ !statusIndicatesArticleIsIgnorable($0.status) }) } }