From 4520d1155993d4ecda0ab18225872a3e1e841ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Vigh?= Date: Fri, 21 May 2021 14:45:40 +0200 Subject: [PATCH] MAPG-235 fix calculating timelimit when 0 sec time was left from the last round --- src/Controller/GameFlowController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Controller/GameFlowController.php b/src/Controller/GameFlowController.php index 88eef5c..9e173d0 100644 --- a/src/Controller/GameFlowController.php +++ b/src/Controller/GameFlowController.php @@ -388,14 +388,14 @@ class GameFlowController // save user relevant state of challenge $userInChallenge->setCurrentRound($nextRound); - if ($this->request->post('timeLeft')) { - $userInChallenge->setTimeLeft(intval($this->request->post('timeLeft'))); + $timeLeft = $this->request->post('timeLeft'); + if (isset($timeLeft)) { + $userInChallenge->setTimeLeft(intval($timeLeft)); } $this->pdm->saveToDb($userInChallenge); - - if ($challenge->getTimeLimitType() === 'game' && $this->request->post('timeLeft')) { - $timeLimit = max(10, intval($this->request->post('timeLeft'))); + if ($challenge->getTimeLimitType() === 'game' && isset($timeLeft)) { + $timeLimit = max(10, intval($timeLeft)); $response['restrictions']['timeLimit'] = $timeLimit * 1000; }