From aaa5ac35704ddb5fb3225fc4d7cad8283c6593ec Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Thu, 13 May 2021 23:28:56 +0200 Subject: [PATCH] Only count unread items in postgres-stream --- pkg/timeline/postgres.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/timeline/postgres.go b/pkg/timeline/postgres.go index a202b40..d4032fb 100644 --- a/pkg/timeline/postgres.go +++ b/pkg/timeline/postgres.go @@ -173,7 +173,7 @@ func (p *postgresStream) Count() (int, error) { return -1, err } defer conn.Close() - row := conn.QueryRowContext(context.Background(), "SELECT COUNT(*) FROM items WHERE channel_id = $1", p.channelID) + row := conn.QueryRowContext(context.Background(), `SELECT COUNT(*) FROM items WHERE channel_id = $1 AND "is_read" = 0`, p.channelID) if row == nil { return 0, nil }