Fix issues relating to how jingles process in song history.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-08-22 23:12:19 -05:00
parent 6a30481626
commit 23ddccd49c
No known key found for this signature in database
GPG Key ID: F1D2E64A0005E80E
3 changed files with 18 additions and 4 deletions

View File

@ -114,6 +114,7 @@ final class SongHistoryRepository extends AbstractStationBasedRepository
$this->em->persist($previousCurrentSong);
}
$newCurrentSong->setListenersFromLastSong($previousCurrentSong);
$newCurrentSong->setTimestampStart(time());
$newCurrentSong->updateVisibility();

View File

@ -275,6 +275,19 @@ class SongHistory implements
$this->delta_points = $delta_points;
}
public function setListenersFromLastSong(?SongHistory $lastSong): void
{
if (null === $lastSong) {
$this->addDeltaPoint(0);
return;
}
$deltaPoints = (array)$lastSong->getDeltaPoints();
$lastDeltaPoint = array_pop($deltaPoints);
$this->addDeltaPoint($lastDeltaPoint);
}
public function getIsVisible(): bool
{
return $this->is_visible;

View File

@ -146,14 +146,14 @@ final class Annotations implements EventSubscriberInterface
return;
}
$event->addAnnotations([
'playlist_id' => $playlist->getId(),
]);
if ($playlist->getIsJingle()) {
$event->addAnnotations([
'jingle_mode' => 'true',
]);
} else {
$event->addAnnotations([
'playlist_id' => $playlist->getId(),
]);
}
}