git.iko.soy/maciek134/podphoenix
on main help sign in
fix query for available Podcasts (#21)

The original query introduced in 16fe00d did not list a podcast with fully listened to episodes. The SQL query has been changed to sum instead of filter for listened. Fixes #19 and #20

commit773838e34ed1856ea6b0e7c8441b9dcd0984e1ee authorSergio Schvezov <sergio.schvezov@canonical.com> dateMon 3 Apr 2023, 09:44 (4 years ago) parente205e39
1 file changed+1−2
app/ui/PodcastsTab.qml+1−2
app/ui/PodcastsTab.qml+1−2
@@ -271,11 +271,10 @@ Page {
271271 db.transaction(function (tx) {
272272 podcastModel.clear();
273273 var rs = tx.executeSql(`
274− SELECT p.rowid as rowid, p.*, COUNT(e.rowid) as episodeCount
274+ SELECT p.rowid as rowid, p.*, sum(CASE WHEN e.listened = 0 THEN 1 ELSE 0 END) as episodeCount
275275 FROM Podcast as p
276276 JOIN Episode as e
277277 ON p.rowid = e.podcast
278− WHERE e.listened = 0
279278 GROUP BY p.rowid
280279 ORDER BY p.name ASC
281280 `);