Only count unread items in postgres-stream
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2021-05-13 23:28:56 +02:00
parent 9267535f9c
commit aaa5ac3570
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -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
}