feat: all time rank display (#149)

* add all time rank to item pages

* fix artist albums component

* add no rows check

* fix rewind page
This commit is contained in:
Gabe Farrell 2026-01-16 01:03:23 -05:00 committed by GitHub
parent d08e05220f
commit 5e294b839c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 301 additions and 202 deletions

View file

@ -124,6 +124,24 @@ FROM (
ORDER BY x.listen_count DESC, x.id
LIMIT $3 OFFSET $4;
-- name: GetTrackAllTimeRank :one
SELECT
id,
rank
FROM (
SELECT
x.id,
RANK() OVER (ORDER BY x.listen_count DESC) AS rank
FROM (
SELECT
t.id,
COUNT(*) AS listen_count
FROM listens l
JOIN tracks_with_title t ON l.track_id = t.id
GROUP BY t.id) x
) y
WHERE id = $1;
-- name: CountTopTracks :one
SELECT COUNT(DISTINCT l.track_id) AS total_count
FROM listens l