From 599d8bf1532012df787fed4a63540bcf2f28ff01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Vigh?= Date: Fri, 21 May 2021 15:41:17 +0200 Subject: [PATCH] MAPG-235 fix unwanted time limit after page reload --- src/Controller/GameFlowController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Controller/GameFlowController.php b/src/Controller/GameFlowController.php index 9e173d0..ba07f54 100644 --- a/src/Controller/GameFlowController.php +++ b/src/Controller/GameFlowController.php @@ -149,6 +149,7 @@ class GameFlowController { $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) { $withRelations = [User::class, PlaceInChallenge::class, Place::class]; @@ -239,7 +240,7 @@ class GameFlowController $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()); $response['restrictions']['timeLimit'] = $timeLimit * 1000; }