Skip to content

Commit

Permalink
fix: return playlist count as dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
anshg1214 committed Sep 16, 2024
1 parent f59367a commit 2e1eb3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions listenbrainz/db/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,12 +985,12 @@ def get_playlist_recordings_metadata(mb_curs, ts_curs, playlist: Playlist) -> Pl
return playlist


def get_playlist_count(ts_conn, creator_ids: List[str]):
def get_playlist_count(ts_conn, creator_ids: List[str]) -> dict:
query = text("""
SELECT creator_id, COUNT(*) as count
FROM playlist.playlist
WHERE creator_id IN :creator_ids
GROUP BY creator_id
""")
result = ts_conn.execute(query, {"creator_ids": tuple(creator_ids)})
return result.fetchall()
return {row[0]: row[1] for row in result.fetchall()}

0 comments on commit 2e1eb3b

Please sign in to comment.