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
6 changed files with 13 additions and 13 deletions
Showing only changes of commit 7970927654 - Show all commits

View File

@ -399,7 +399,7 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
Game.timeoutEnd = null; Game.timeoutEnd = null;
}, },
hideRestrictions: function() { hideRestrictions: function () {
var restrictions = document.getElementById('restrictions'); var restrictions = document.getElementById('restrictions');
if (restrictions) { if (restrictions) {
var header = restrictions.parentNode; var header = restrictions.parentNode;
@ -957,7 +957,7 @@ const GameType = Object.freeze({ 'SINGLE': 0, 'MULTI': 1, 'CHALLENGE': 2 });
}, },
showHighscores: function() { showHighscores: function () {
if (Game.type == GameType.CHALLENGE) { if (Game.type == GameType.CHALLENGE) {
var highscores = this.calculateHighScores(); var highscores = this.calculateHighScores();

View File

@ -208,7 +208,7 @@ class GameController implements ISecured
$room = $this->multiRoomRepository->getByRoomId($roomId); $room = $this->multiRoomRepository->getByRoomId($roomId);
if(!isset($room)) { if (!isset($room)) {
return new JsonContent(['error' => 'game_not_found']); return new JsonContent(['error' => 'game_not_found']);
} }
@ -265,7 +265,7 @@ class GameController implements ISecured
return new JsonContent(['error' => 'game_not_found']); return new JsonContent(['error' => 'game_not_found']);
} }
if(!$this->userInChallengeRepository->isUserParticipatingInChallenge($userId, $challenge)) { if (!$this->userInChallengeRepository->isUserParticipatingInChallenge($userId, $challenge)) {
// new player is joining // new player is joining
$userInChallenge = new UserInChallenge(); $userInChallenge = new UserInChallenge();
$userInChallenge->setUserId($userId); $userInChallenge->setUserId($userId);

View File

@ -309,9 +309,9 @@ class GameFlowController implements ISecured
$session = $this->request->session(); $session = $this->request->session();
$userId = $session->get('userId'); $userId = $session->get('userId');
if(isset($userId)) { if (isset($userId)) {
$userPlayedPlace = $this->userPlayedPlaceRepository->getByUserIdAndPlaceId($userId, $placeId); $userPlayedPlace = $this->userPlayedPlaceRepository->getByUserIdAndPlaceId($userId, $placeId);
if(!$userPlayedPlace) { if (!$userPlayedPlace) {
$userPlayedPlace = new UserPlayedPlace(); $userPlayedPlace = new UserPlayedPlace();
$userPlayedPlace->setUserId($userId); $userPlayedPlace->setUserId($userId);
$userPlayedPlace->setPlaceId($placeId); $userPlayedPlace->setPlaceId($placeId);
@ -415,7 +415,7 @@ class GameFlowController implements ISecured
$response['restrictions']['timeLimit'] = $timeLimit * 1000; $response['restrictions']['timeLimit'] = $timeLimit * 1000;
} }
if(isset($response['history'][$currentRound]['allResults'])) { if (isset($response['history'][$currentRound]['allResults'])) {
$response['allResults'] = $response['history'][$currentRound]['allResults']; $response['allResults'] = $response['history'][$currentRound]['allResults'];
} }

View File

@ -261,7 +261,7 @@ class Select
$queryString .= ' LIMIT ' . $this->limit[1] . ', ' . $this->limit[0]; $queryString .= ' LIMIT ' . $this->limit[1] . ', ' . $this->limit[0];
} }
if($this->isDerivedTable()) { if ($this->isDerivedTable()) {
$queryString = '(' . $queryString . ') AS ' . $this->tableAliases[Select::DERIVED_TABLE_KEY]; $queryString = '(' . $queryString . ') AS ' . $this->tableAliases[Select::DERIVED_TABLE_KEY];
} }
@ -276,7 +276,7 @@ class Select
return [(string) $table, $params]; return [(string) $table, $params];
} }
if($table instanceof Select) if ($table instanceof Select)
{ {
return $table->generateQuery(); return $table->generateQuery();
} }
@ -332,7 +332,7 @@ class Select
$joinQueries = []; $joinQueries = [];
$params = []; $params = [];
foreach($this->joins as $join) { foreach ($this->joins as $join) {
list($joinQueryFragment, $paramsFragment) = $this->generateTable($join[1], true); list($joinQueryFragment, $paramsFragment) = $this->generateTable($join[1], true);
$joinQueries[] = $join[0] . ' JOIN ' . $joinQueryFragment . ' ON ' . $this->generateColumn($join[2]) . ' ' . $join[3] . ' ' . $this->generateColumn($join[4]); $joinQueries[] = $join[0] . ' JOIN ' . $joinQueryFragment . ' ON ' . $this->generateColumn($join[2]) . ' ' . $join[3] . ' ' . $this->generateColumn($join[4]);
$params = array_merge($params, $paramsFragment); $params = array_merge($params, $paramsFragment);

View File

@ -33,7 +33,7 @@ class Challenge extends Model
public function setTimeLimit(?int $timeLimit): void public function setTimeLimit(?int $timeLimit): void
{ {
if(isset($timeLimit)) { if (isset($timeLimit)) {
$this->timeLimit = $timeLimit; $this->timeLimit = $timeLimit;
} }
} }

View File

@ -49,7 +49,7 @@ class UserInChallenge extends Model
public function setTimeLeft(?int $timeLeft): void public function setTimeLeft(?int $timeLeft): void
{ {
if(isset($timeLeft)) { if (isset($timeLeft)) {
$this->timeLeft = max(0, $timeLeft); $this->timeLeft = max(0, $timeLeft);
} }
} }