From: xangelo Date: Mon, 12 Feb 2024 20:31:41 +0000 (-0500) Subject: fix: display feed if no unreaditems X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=2fd35259d9aa14153857635d6d7f41c0e9fdccb8;p=river.git fix: display feed if no unreaditems --- diff --git a/src/server.ts b/src/server.ts index 7ed5556..58e726c 100644 --- a/src/server.ts +++ b/src/server.ts @@ -206,10 +206,11 @@ app.post('/feeds', async (req, res) => { app.get('/feeds', async (req, res) => { const feedList: FeedSchemaWithUnread[] = await db.raw(` -select f.*, count(fe.id) as unread +select + f.*, + count(fe.feed_id) - sum(fe.is_read) as unread from feeds f -join feed_entry fe on fe.feed_id = f.id -where fe.is_read is false +join feed_entry fe on fe.feed_id = f.id group by fe.feed_id `);