Skip to content

Commit

Permalink
improve duplicate check by tracking all static media IDs right away
Browse files Browse the repository at this point in the history
  • Loading branch information
brookgagnon committed Jan 25, 2025
1 parent e6784dd commit 8c706e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion models/playlists_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,13 @@ public function resolve($playlist_id, $player_id, $parent_player_id = false, $st
$used_ids = [];
$used_ids_stationid = [];

// add our static media items to our used IDs right away
foreach ($playlist_items as $playlist_item) {
if ($playlist_item['item_type'] == 'media') {
$used_ids[] = $playlist_item['item_id'];
}
}

// track items to return
$return = [];

Expand Down Expand Up @@ -772,7 +779,6 @@ public function resolve($playlist_id, $player_id, $parent_player_id = false, $st
}
}
$media_items_tmp[] = $tmp;
$used_ids[] = $tmp['id'];
}
} elseif ($playlist_item['item_type'] == 'dynamic') {
// dynamic item
Expand Down

0 comments on commit 8c706e1

Please sign in to comment.