From 2fd35259d9aa14153857635d6d7f41c0e9fdccb8 Mon Sep 17 00:00:00 2001 From: xangelo Date: Mon, 12 Feb 2024 15:31:41 -0500 Subject: [PATCH] fix: display feed if no unreaditems --- src/server.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 `); -- 2.25.1