MAPG-235 fix calculating timelimit when 0 sec time was left from the last round

This commit is contained in:
Balázs Vigh 2021-05-21 14:45:40 +02:00
parent 5f0b639fe7
commit 4520d11559

View File

@ -388,14 +388,14 @@ class GameFlowController
// save user relevant state of challenge // save user relevant state of challenge
$userInChallenge->setCurrentRound($nextRound); $userInChallenge->setCurrentRound($nextRound);
if ($this->request->post('timeLeft')) { $timeLeft = $this->request->post('timeLeft');
$userInChallenge->setTimeLeft(intval($this->request->post('timeLeft'))); if (isset($timeLeft)) {
$userInChallenge->setTimeLeft(intval($timeLeft));
} }
$this->pdm->saveToDb($userInChallenge); $this->pdm->saveToDb($userInChallenge);
if ($challenge->getTimeLimitType() === 'game' && isset($timeLeft)) {
if ($challenge->getTimeLimitType() === 'game' && $this->request->post('timeLeft')) { $timeLimit = max(10, intval($timeLeft));
$timeLimit = max(10, intval($this->request->post('timeLeft')));
$response['restrictions']['timeLimit'] = $timeLimit * 1000; $response['restrictions']['timeLimit'] = $timeLimit * 1000;
} }