fix: stabilized the order of top items

pull/23/head
Gabe Farrell 6 months ago
parent a1b6724179
commit c9042e19ad

@ -69,7 +69,7 @@ JOIN artist_tracks at ON at.track_id = t.id
JOIN artists_with_name a ON a.id = at.artist_id
WHERE l.listened_at BETWEEN $1 AND $2
GROUP BY a.id, a.name, a.musicbrainz_id, a.image, a.image_source, a.name
ORDER BY listen_count DESC
ORDER BY listen_count DESC, a.id
LIMIT $3 OFFSET $4;
-- name: CountTopArtists :one

@ -41,7 +41,7 @@ JOIN artist_releases ar ON r.id = ar.release_id
WHERE ar.artist_id = $5
AND l.listened_at BETWEEN $1 AND $2
GROUP BY r.id, r.title, r.musicbrainz_id, r.various_artists, r.image, r.image_source
ORDER BY listen_count DESC
ORDER BY listen_count DESC, r.id
LIMIT $3 OFFSET $4;
-- name: GetTopReleasesPaginated :many
@ -54,7 +54,7 @@ JOIN tracks t ON l.track_id = t.id
JOIN releases_with_title r ON t.release_id = r.id
WHERE l.listened_at BETWEEN $1 AND $2
GROUP BY r.id, r.title, r.musicbrainz_id, r.various_artists, r.image, r.image_source
ORDER BY listen_count DESC
ORDER BY listen_count DESC, r.id
LIMIT $3 OFFSET $4;
-- name: CountTopReleases :one

@ -49,7 +49,7 @@ JOIN tracks_with_title t ON l.track_id = t.id
JOIN releases r ON t.release_id = r.id
WHERE l.listened_at BETWEEN $1 AND $2
GROUP BY t.id, t.title, t.musicbrainz_id, t.release_id, r.image
ORDER BY listen_count DESC
ORDER BY listen_count DESC, t.id
LIMIT $3 OFFSET $4;
-- name: GetTopTracksByArtistPaginated :many
@ -68,7 +68,7 @@ JOIN artist_tracks at ON at.track_id = t.id
WHERE l.listened_at BETWEEN $1 AND $2
AND at.artist_id = $5
GROUP BY t.id, t.title, t.musicbrainz_id, t.release_id, r.image
ORDER BY listen_count DESC
ORDER BY listen_count DESC, t.id
LIMIT $3 OFFSET $4;
-- name: GetTopTracksInReleasePaginated :many
@ -86,7 +86,7 @@ JOIN releases r ON t.release_id = r.id
WHERE l.listened_at BETWEEN $1 AND $2
AND t.release_id = $5
GROUP BY t.id, t.title, t.musicbrainz_id, t.release_id, r.image
ORDER BY listen_count DESC
ORDER BY listen_count DESC, t.id
LIMIT $3 OFFSET $4;
-- name: CountTopTracks :one

@ -256,7 +256,7 @@ JOIN artist_tracks at ON at.track_id = t.id
JOIN artists_with_name a ON a.id = at.artist_id
WHERE l.listened_at BETWEEN $1 AND $2
GROUP BY a.id, a.name, a.musicbrainz_id, a.image, a.image_source, a.name
ORDER BY listen_count DESC
ORDER BY listen_count DESC, a.id
LIMIT $3 OFFSET $4
`

@ -260,7 +260,7 @@ JOIN artist_releases ar ON r.id = ar.release_id
WHERE ar.artist_id = $5
AND l.listened_at BETWEEN $1 AND $2
GROUP BY r.id, r.title, r.musicbrainz_id, r.various_artists, r.image, r.image_source
ORDER BY listen_count DESC
ORDER BY listen_count DESC, r.id
LIMIT $3 OFFSET $4
`
@ -328,7 +328,7 @@ JOIN tracks t ON l.track_id = t.id
JOIN releases_with_title r ON t.release_id = r.id
WHERE l.listened_at BETWEEN $1 AND $2
GROUP BY r.id, r.title, r.musicbrainz_id, r.various_artists, r.image, r.image_source
ORDER BY listen_count DESC
ORDER BY listen_count DESC, r.id
LIMIT $3 OFFSET $4
`

@ -146,7 +146,7 @@ JOIN artist_tracks at ON at.track_id = t.id
WHERE l.listened_at BETWEEN $1 AND $2
AND at.artist_id = $5
GROUP BY t.id, t.title, t.musicbrainz_id, t.release_id, r.image
ORDER BY listen_count DESC
ORDER BY listen_count DESC, t.id
LIMIT $3 OFFSET $4
`
@ -217,7 +217,7 @@ JOIN releases r ON t.release_id = r.id
WHERE l.listened_at BETWEEN $1 AND $2
AND t.release_id = $5
GROUP BY t.id, t.title, t.musicbrainz_id, t.release_id, r.image
ORDER BY listen_count DESC
ORDER BY listen_count DESC, t.id
LIMIT $3 OFFSET $4
`
@ -287,7 +287,7 @@ JOIN tracks_with_title t ON l.track_id = t.id
JOIN releases r ON t.release_id = r.id
WHERE l.listened_at BETWEEN $1 AND $2
GROUP BY t.id, t.title, t.musicbrainz_id, t.release_id, r.image
ORDER BY listen_count DESC
ORDER BY listen_count DESC, t.id
LIMIT $3 OFFSET $4
`

Loading…
Cancel
Save