MAPG-235 fix unwanted time limit after page reload

This commit is contained in:
Balázs Vigh 2021-05-21 15:41:17 +02:00
parent 636c47366a
commit 599d8bf153

View File

@ -149,6 +149,7 @@ class GameFlowController
{ {
$currentPlace = $this->placeRepository->getByRoundInChallenge($challenge, $currentRound); $currentPlace = $this->placeRepository->getByRoundInChallenge($challenge, $currentRound);
// if the last round was played ($currentPlace == null) or history is explicitly requested (for initializing)
if (!isset($currentPlace) || $withHistory) { if (!isset($currentPlace) || $withHistory) {
$withRelations = [User::class, PlaceInChallenge::class, Place::class]; $withRelations = [User::class, PlaceInChallenge::class, Place::class];
@ -239,7 +240,7 @@ class GameFlowController
$response = $this->prepareChallengeResponse($userId, $challenge, $currentRound, true); $response = $this->prepareChallengeResponse($userId, $challenge, $currentRound, true);
if ($challenge->getTimeLimitType() === 'game' && $userInChallenge->getCurrentRound() > 0) { if ($challenge->getTimeLimitType() === 'game' && $challenge->getTimeLimit() !== null && $userInChallenge->getCurrentRound() > 0) {
$timeLimit = max(10, $userInChallenge->getTimeLeft()); $timeLimit = max(10, $userInChallenge->getTimeLeft());
$response['restrictions']['timeLimit'] = $timeLimit * 1000; $response['restrictions']['timeLimit'] = $timeLimit * 1000;
} }