Simplify filterIncomingArticles.

This commit is contained in:
Brent Simmons 2017-09-21 18:14:37 -07:00
parent d9f0e53312
commit a7063f7a5d
1 changed files with 3 additions and 10 deletions

View File

@ -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<Article>, _ statuses: [String: ArticleStatus]) -> Set<Article> {
func filterIncomingArticles(_ articles: Set<Article>) -> Set<Article> {
// 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) })
}
}