MAPG-235 time limit restriction for the whole game feature added

This commit is contained in:
balazs committed 2021-05-20 21:32:01 +02:00
1 parent c2df9b7713
commit b78d564f6f
2 files changed
+19 -2

No files matched your search

+10
View File
@@ -381,9 +381,19 @@ class GameFlowController
$response['result'] = ['distance' => null, 'score' => 0];
}
// save user relevant state of challenge
$userInChallenge->setCurrentRound($nextRound);
if ($this->request->post('timeLeft')) {
$userInChallenge->setTimeLeft(intval($this->request->post('timeLeft')));
}
$this->pdm->saveToDb($userInChallenge);
if ($challenge->getTimeLimitType() === 'game' && $this->request->post('timeLeft')) {
$timeLimit = max(10, intval($this->request->post('timeLeft')));
$response['restrictions']['timeLimit'] = $timeLimit * 1000;
}
if(isset($response['history'][$currentRound]['allResults'])) {
$response['allResults'] = $response['history'][$currentRound]['allResults'];
}