From cf5a38a3769233d68cbe7626b75b08f5541fc0fd Mon Sep 17 00:00:00 2001 From: Connor Johnstone Date: Thu, 26 Mar 2026 13:20:20 -0400 Subject: [PATCH] Attempt to fix playlist gen dropdown --- src/queries/tracks.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/queries/tracks.rs b/src/queries/tracks.rs index 25cdae2..25ce75e 100644 --- a/src/queries/tracks.rs +++ b/src/queries/tracks.rs @@ -87,6 +87,13 @@ pub async fn get_by_artist(db: &DatabaseConnection, artist_id: i32) -> DbResult< .await?) } +pub async fn count_by_artist(db: &DatabaseConnection, artist_id: i32) -> DbResult { + Ok(Tracks::find() + .filter(track::Column::ArtistId.eq(artist_id)) + .count(db) + .await?) +} + /// Get tracks that need metadata enrichment — either no MBID at all, /// or have an MBID but are missing album info (e.g., freshly downloaded). pub async fn get_needing_metadata(db: &DatabaseConnection) -> DbResult> {