Fix bug getting unread count for the Today smart feed — it would skip articles with no pubDate, but that did arrive today (and thus should be considered as part of Today).

This commit is contained in:
Brent Simmons 2019-02-08 21:05:55 -08:00
parent 7f82f9d607
commit 1466f7e919
1 changed files with 2 additions and 1 deletions

View File

@ -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)