feature/MAPG-235-basic-challenge-mode #48

Merged
balazs merged 43 commits from feature/MAPG-235-basic-challenge-mode into develop 2021-05-28 20:41:09 +02:00
Showing only changes of commit 599d8bf153 - Show all commits

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;
} }