Skip to content

Commit

Permalink
Fix an AutoDJ Queue builder issue related to the time migration.
Browse files Browse the repository at this point in the history
  • Loading branch information
BusterNeece committed Feb 17, 2025
1 parent 1152804 commit f63e46a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/src/Radio/AutoDJ/DuplicatePrevention.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

use App\Container\LoggerAwareTrait;
use App\Entity\Api\StationPlaylistQueue;
use Carbon\CarbonImmutable;

/**
* @phpstan-type PlayedTrack array{
* song_id: string,
* text: string|null,
* artist: string|null,
* title: string|null,
* timestamp_played: int
* timestamp_played: CarbonImmutable|int
* }
*/
final class DuplicatePrevention
Expand Down Expand Up @@ -52,7 +53,12 @@ public function preventDuplicates(
$songId = $playedTrack['song_id'];

if (!isset($latestSongIdsPlayed[$songId])) {
$latestSongIdsPlayed[$songId] = $playedTrack['timestamp_played'];
$timestampPlayed = $playedTrack['timestamp_played'];
if ($timestampPlayed instanceof CarbonImmutable) {
$timestampPlayed = $timestampPlayed->getTimestamp();
}

$latestSongIdsPlayed[$songId] = $timestampPlayed;
}
}

Expand Down

0 comments on commit f63e46a

Please sign in to comment.