From 1466f7e91992eba5c3e9a9216a37a771bf91bb0b Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 8 Feb 2019 21:05:55 -0800 Subject: [PATCH] =?UTF-8?q?Fix=20bug=20getting=20unread=20count=20for=20th?= =?UTF-8?q?e=20Today=20smart=20feed=20=E2=80=94=C2=A0it=20would=20skip=20a?= =?UTF-8?q?rticles=20with=20no=20pubDate,=20but=20that=20did=20arrive=20to?= =?UTF-8?q?day=20(and=20thus=20should=20be=20considered=20as=20part=20of?= =?UTF-8?q?=20Today).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/ArticlesDatabase/ArticlesTable.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Frameworks/ArticlesDatabase/ArticlesTable.swift b/Frameworks/ArticlesDatabase/ArticlesTable.swift index ab165190e..96c840e06 100644 --- a/Frameworks/ArticlesDatabase/ArticlesTable.swift +++ b/Frameworks/ArticlesDatabase/ArticlesTable.swift @@ -160,11 +160,12 @@ final class ArticlesTable: DatabaseTable { queue.fetch { (database) in let placeholders = NSString.rs_SQLValueList(withPlaceholders: UInt(feedIDs.count))! - let sql = "select count(*) from articles natural join statuses where feedID in \(placeholders) and datePublished > ? and read=0 and userDeleted=0;" + let sql = "select count(*) from articles natural join statuses where feedID in \(placeholders) and (datePublished > ? or (datePublished is null and dateArrived > ?)) and read=0 and userDeleted=0;" var parameters = [Any]() parameters += Array(feedIDs) as [Any] parameters += [since] as [Any] + parameters += [since] as [Any] let unreadCount = self.numberWithSQLAndParameters(sql, parameters, in: database)