From 3ab16ceddd1c9c1dd344133edadb96e6396c03b1 Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:24:37 -0800 Subject: [PATCH] Fix trending playlists (#10404) --- .../src/queries/get_extended_purchase_gate.py | 2 ++ .../discovery-provider/src/queries/get_trending_playlists.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/discovery-provider/src/queries/get_extended_purchase_gate.py b/packages/discovery-provider/src/queries/get_extended_purchase_gate.py index 921a5162f08..cd8ff3a2b40 100644 --- a/packages/discovery-provider/src/queries/get_extended_purchase_gate.py +++ b/packages/discovery-provider/src/queries/get_extended_purchase_gate.py @@ -259,6 +259,8 @@ def get_legacy_purchase_gate(gate: AccessGate, session=None): if gate and "usdc_purchase" in gate: # mypy gets confused.... gate = cast(PurchaseGate, gate) + if isinstance(gate["usdc_purchase"]["splits"], dict): + return gate if session: new_gate = _get_extended_purchase_gate(session, gate) else: diff --git a/packages/discovery-provider/src/queries/get_trending_playlists.py b/packages/discovery-provider/src/queries/get_trending_playlists.py index ef4bb8b1895..a6c38666146 100644 --- a/packages/discovery-provider/src/queries/get_trending_playlists.py +++ b/packages/discovery-provider/src/queries/get_trending_playlists.py @@ -342,13 +342,14 @@ def _get_trending_playlists_with_session( # Re-associate tracks with playlists # track_id -> populated_track - populated_track_map = {track["track_id"]: track for track in populated_tracks} + populated_track_map = { + track["track_id"]: extend_track(track) for track in populated_tracks + } for playlist in playlists_map.values(): for i in range(len(playlist["tracks"])): track_id = playlist["tracks"][i]["track_id"] populated = populated_track_map[track_id] playlist["tracks"][i] = populated - playlist["tracks"] = list(map(extend_track, playlist["tracks"])) # re-sort playlists to original order, because populate_playlist_metadata # unsorts.