From 38a5baa17eb8df38090fea66c7968b9b1b4531e7 Mon Sep 17 00:00:00 2001 From: Brock H Caldwell Date: Wed, 11 Jun 2025 20:06:49 -0500 Subject: [PATCH] fix: sets tv show/season monitor status to Active after executing --- src/Monitor/Action/Handler/MonitorTvSeasonHandler.php | 6 ++---- src/Monitor/Action/Handler/MonitorTvShowHandler.php | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Monitor/Action/Handler/MonitorTvSeasonHandler.php b/src/Monitor/Action/Handler/MonitorTvSeasonHandler.php index e139854..97665d6 100644 --- a/src/Monitor/Action/Handler/MonitorTvSeasonHandler.php +++ b/src/Monitor/Action/Handler/MonitorTvSeasonHandler.php @@ -55,10 +55,6 @@ readonly class MonitorTvSeasonHandler implements HandlerInterface $this->logger->info('> [MonitorTvSeasonHandler] Found ' . count($episodesInSeason) . ' episodes in season ' . $monitor->getSeason() . ' for title: ' . $monitor->getTitle()); if ($downloadedEpisodes->count() !== $episodesInSeason->count()) { - // Since $monitor has children monitors, set the status - // to Active, so it will be re-executed. - $monitor->setStatus('Active'); - // Dispatch Episode commands for each missing Episode foreach ($episodesInSeason as $episode) { // Check if the episode is already downloaded @@ -99,6 +95,8 @@ readonly class MonitorTvSeasonHandler implements HandlerInterface } } + // Set the status to Active, so it will be re-executed. + $monitor->setStatus('Active'); $monitor->setLastSearch(new DateTimeImmutable()); $monitor->setSearchCount($monitor->getSearchCount() + 1); diff --git a/src/Monitor/Action/Handler/MonitorTvShowHandler.php b/src/Monitor/Action/Handler/MonitorTvShowHandler.php index e891399..3d65bc2 100644 --- a/src/Monitor/Action/Handler/MonitorTvShowHandler.php +++ b/src/Monitor/Action/Handler/MonitorTvShowHandler.php @@ -56,10 +56,6 @@ readonly class MonitorTvShowHandler implements HandlerInterface $this->logger->info('> [MonitorTvShowHandler] Found ' . count($episodesInShow) . ' episodes for title: ' . $monitor->getTitle()); if ($downloadedEpisodes->count() !== $episodesInShow->count()) { - // Since $monitor has children monitors, set the status - // to Active, so it will be re-executed. - $monitor->setStatus('Active'); - // Dispatch Episode commands for each missing Episode foreach ($episodesInShow as $episode) { // Check if the episode is already downloaded @@ -102,6 +98,8 @@ readonly class MonitorTvShowHandler implements HandlerInterface } } + // Set the status to Active, so it will be re-executed. + $monitor->setStatus('Active'); $monitor->setLastSearch(new DateTimeImmutable()); $monitor->setSearchCount($monitor->getSearchCount() + 1); $this->entityManager->flush();