From 31601f718e79258c1cd47e767454eee1b4c87f96 Mon Sep 17 00:00:00 2001 From: thepercival Date: Thu, 25 Apr 2024 20:17:02 +0200 Subject: [PATCH] fix(output): package --- domain/Game/Assigner.php | 7 ++++--- tests/helpers/PlanningCreator.php | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/domain/Game/Assigner.php b/domain/Game/Assigner.php index 52addb1..c7b861c 100644 --- a/domain/Game/Assigner.php +++ b/domain/Game/Assigner.php @@ -23,7 +23,7 @@ public function __construct(protected LoggerInterface $logger) $this->throwOnTimeout = true; } - public function assignGames(Planning $planning): void + public function assignGames(Planning $planning): bool { $games = (new PreAssignSorter())->getGames($planning); // (new GameOutput($this->logger))->outputGames($games); @@ -46,7 +46,7 @@ public function assignGames(Planning $planning): void } else { $planning->setTimeoutState(null); } - return; + return false; } $firstBatch = $planning->createFirstBatch(); @@ -68,12 +68,13 @@ public function assignGames(Planning $planning): void $planning->setTimeoutState(null); } $this->logger->error(' could not assign refereeplaces (plId:' . (string)$planning->getId() . ')'); - return; + return false; } } $planning->setState(PlanningState::Succeeded); $planning->setTimeoutState(null); $planning->setNrOfBatches($firstBatch->getLeaf()->getNumber()); + return true; } public function disableThrowOnTimeout(): void diff --git a/tests/helpers/PlanningCreator.php b/tests/helpers/PlanningCreator.php index e08bfb6..ec0f9fa 100644 --- a/tests/helpers/PlanningCreator.php +++ b/tests/helpers/PlanningCreator.php @@ -175,9 +175,7 @@ protected function createPlanning( if ($showHighestCompletedBatchNr) { $gameAssigner->showHighestCompletedBatchNr(); } - $gameAssigner->assignGames($planning); - - if (PlanningState::Succeeded !== $planning->getState()) { + if( $gameAssigner->assignGames($planning) === false ) { throw new Exception("planning could not be created", E_ERROR); } return $planning;