Base our active articles window on dateArrived instead of datePublished. This reverses a recent change that led to some bugs.
This commit is contained in:
parent
ac519c5c90
commit
388886a355
|
@ -305,9 +305,9 @@ final class ArticlesTable: DatabaseTable {
|
|||
queue.runInDatabase { databaseResult in
|
||||
|
||||
func makeDatabaseCalls(_ database: FMDatabase) {
|
||||
let sql = "select distinct feedID, count(*) from articles natural join statuses where read=0 and userDeleted=0 and (starred=1 or (datePublished > ? or (datePublished is null and dateArrived > ?))) group by feedID;"
|
||||
let sql = "select distinct feedID, count(*) from articles natural join statuses where read=0 and userDeleted=0 and (starred=1 or dateArrived>?) group by feedID;"
|
||||
|
||||
guard let resultSet = database.executeQuery(sql, withArgumentsIn: [cutoffDate, cutoffDate]) else {
|
||||
guard let resultSet = database.executeQuery(sql, withArgumentsIn: [cutoffDate]) else {
|
||||
DispatchQueue.main.async {
|
||||
completion(.success(UnreadCountDictionary()))
|
||||
}
|
||||
|
@ -587,8 +587,8 @@ private extension ArticlesTable {
|
|||
// * Must be either 1) starred or 2) dateArrived must be newer than cutoff date.
|
||||
|
||||
if withLimits {
|
||||
let sql = "select * from articles natural join statuses where \(whereClause) and userDeleted=0 and (starred=1 or (datePublished > ? or (datePublished is null and dateArrived > ?)));"
|
||||
return articlesWithSQL(sql, parameters + [articleCutoffDate as AnyObject] + [articleCutoffDate as AnyObject], database)
|
||||
let sql = "select * from articles natural join statuses where \(whereClause) and userDeleted=0 and (starred=1 or dateArrived>?);"
|
||||
return articlesWithSQL(sql, parameters + [articleCutoffDate as AnyObject], database)
|
||||
}
|
||||
else {
|
||||
let sql = "select * from articles natural join statuses where \(whereClause);"
|
||||
|
@ -602,8 +602,8 @@ private extension ArticlesTable {
|
|||
// * Must not be deleted.
|
||||
// * Must be either 1) starred or 2) dateArrived must be newer than cutoff date.
|
||||
|
||||
let sql = "select count(*) from articles natural join statuses where feedID=? and read=0 and userDeleted=0 and (starred=1 or (datePublished > ? or (datePublished is null and dateArrived > ?)));"
|
||||
return numberWithSQLAndParameters(sql, [webFeedID, articleCutoffDate, articleCutoffDate], in: database)
|
||||
let sql = "select count(*) from articles natural join statuses where feedID=? and read=0 and userDeleted=0 and (starred=1 or dateArrived>?);"
|
||||
return numberWithSQLAndParameters(sql, [webFeedID, articleCutoffDate], in: database)
|
||||
}
|
||||
|
||||
func fetchArticlesMatching(_ searchString: String, _ database: FMDatabase) -> Set<Article> {
|
||||
|
@ -885,9 +885,6 @@ private extension ArticlesTable {
|
|||
if article.status.starred {
|
||||
return false
|
||||
}
|
||||
if let datePublished = article.datePublished {
|
||||
return datePublished < articleCutoffDate
|
||||
}
|
||||
return article.status.dateArrived < articleCutoffDate
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue