Skip to content

Commit

Permalink
fix(output): package
Browse files Browse the repository at this point in the history
  • Loading branch information
thepercival committed Apr 25, 2024
1 parent 291bb4d commit 31601f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 4 additions & 3 deletions domain/Game/Assigner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -46,7 +46,7 @@ public function assignGames(Planning $planning): void
} else {
$planning->setTimeoutState(null);
}
return;
return false;
}

$firstBatch = $planning->createFirstBatch();
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions tests/helpers/PlanningCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 31601f7

Please sign in to comment.