From 80c8a848e929d7d6046ee17042d354a64d335c4e Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 13 Sep 2017 21:52:11 -0700 Subject: [PATCH] Slightly simplify related-object adding code. --- Frameworks/Database/ArticlesTable.swift | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Frameworks/Database/ArticlesTable.swift b/Frameworks/Database/ArticlesTable.swift index 5552e8ed4..2130b9bea 100644 --- a/Frameworks/Database/ArticlesTable.swift +++ b/Frameworks/Database/ArticlesTable.swift @@ -206,20 +206,11 @@ private extension ArticlesTable { var articles = Set
() for stubArticle in articles { - var authors: Set? = nil - var attachments: Set? = nil - var tags: Set? = nil let articleID = stubArticle.articleID - if let authorsMap = authorsMap { - authors = authorsMap.authors(for: articleID) - } - if let attachmentsMap = attachmentsMap { - attachments = attachmentsMap.attachments(for: articleID) - } - if let tagsMap = tagsMap { - tags = tagsMap.tags(for: articleID) - } + let authors = authorsMap?.authors(for: articleID) + let attachments = attachmentsMap?.attachments(for: articleID) + let tags = tagsMap?.tags(for: articleID) let realArticle = stubArticle.articleByAttaching(authors, attachments, tags) articles.insert(realArticle)