Skip to content

Commit

Permalink
Fix trending playlists (#10404)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickyrombo authored Nov 8, 2024
1 parent 20e7fb3 commit 3ab16ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3ab16ce

Please sign in to comment.