From 8b0b180a8eab1ac0f77a8b01557e8ce05af15fbd Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Tue, 13 Feb 2024 21:43:26 -0800 Subject: [PATCH] Patch decimal return type serialization --- .../discovery-provider/src/queries/get_remixable_tracks.py | 3 ++- packages/discovery-provider/src/queries/get_top_playlists.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/discovery-provider/src/queries/get_remixable_tracks.py b/packages/discovery-provider/src/queries/get_remixable_tracks.py index c2d2f6afcd2..24785ee4d04 100644 --- a/packages/discovery-provider/src/queries/get_remixable_tracks.py +++ b/packages/discovery-provider/src/queries/get_remixable_tracks.py @@ -67,7 +67,8 @@ def get_remixable_tracks(args): tracks = [] for result in results: track = result[0] - score = result[-1] + # Convert decimal to int + score = int(result[-1]) track = helpers.model_to_dictionary(track) track["score"] = score tracks.append(track) diff --git a/packages/discovery-provider/src/queries/get_top_playlists.py b/packages/discovery-provider/src/queries/get_top_playlists.py index ce2951a695e..1635923101a 100644 --- a/packages/discovery-provider/src/queries/get_top_playlists.py +++ b/packages/discovery-provider/src/queries/get_top_playlists.py @@ -138,7 +138,8 @@ def get_top_playlists_sql(kind: TopPlaylistKind, args: GetTopPlaylistsArgs): for result in playlist_results: # The playlist is the portion of the query result before repost_count and score playlist = result[0:-2] - score = result[-1] + # Convert decimal to int + score = int(result[-1]) # Convert the playlist row tuple into a dictionary keyed by column name playlist = helpers.tuple_to_model_dictionary(playlist, Playlist)