mirror of https://github.com/KDE/kasts.git
Only mark episodes as read/new on new feeds, not on existing ones
This commit is contained in:
parent
056a7b7835
commit
26986616c7
|
@ -140,20 +140,22 @@ void Fetcher::processFeed(Syndication::FeedPtr feed, const QString &url)
|
||||||
processEntry(entry, url, isNewFeed);
|
processEntry(entry, url, isNewFeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now mark the appropriate number of recent entries "new" and "read" for new feeds
|
// Now mark the appropriate number of recent entries "new" and "read" for new feeds only
|
||||||
query.prepare(QStringLiteral("SELECT * FROM Entries WHERE feed=:feed ORDER BY updated DESC LIMIT :recentNew;"));
|
if (isNewFeed) {
|
||||||
query.bindValue(QStringLiteral(":feed"), url);
|
query.prepare(QStringLiteral("SELECT * FROM Entries WHERE feed=:feed ORDER BY updated DESC LIMIT :recentNew;"));
|
||||||
query.bindValue(QStringLiteral(":recentNew"), AlligatorSettings::self()->numberNewEpisodes());
|
query.bindValue(QStringLiteral(":feed"), url);
|
||||||
Database::instance().execute(query);
|
query.bindValue(QStringLiteral(":recentNew"), AlligatorSettings::self()->numberNewEpisodes());
|
||||||
QSqlQuery updateQuery;
|
Database::instance().execute(query);
|
||||||
while (query.next()) {
|
QSqlQuery updateQuery;
|
||||||
qDebug() << "new" << query.value(QStringLiteral("id")).toString();
|
while (query.next()) {
|
||||||
updateQuery.prepare(QStringLiteral("UPDATE Entries SET read=:read, new=:new WHERE id=:id AND feed=:feed;"));
|
qDebug() << "Marked as new:" << query.value(QStringLiteral("id")).toString();
|
||||||
updateQuery.bindValue(QStringLiteral(":read"), false);
|
updateQuery.prepare(QStringLiteral("UPDATE Entries SET read=:read, new=:new WHERE id=:id AND feed=:feed;"));
|
||||||
updateQuery.bindValue(QStringLiteral(":new"), true);
|
updateQuery.bindValue(QStringLiteral(":read"), false);
|
||||||
updateQuery.bindValue(QStringLiteral(":feed"), url);
|
updateQuery.bindValue(QStringLiteral(":new"), true);
|
||||||
updateQuery.bindValue(QStringLiteral(":id"), query.value(QStringLiteral("id")).toString());
|
updateQuery.bindValue(QStringLiteral(":feed"), url);
|
||||||
Database::instance().execute(updateQuery);
|
updateQuery.bindValue(QStringLiteral(":id"), query.value(QStringLiteral("id")).toString());
|
||||||
|
Database::instance().execute(updateQuery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT feedUpdated(url);
|
Q_EMIT feedUpdated(url);
|
||||||
|
|
Loading…
Reference in New Issue