MAPG-235 queries with relations on any recursion level implemented
This commit is contained in:
1 parent
21e41b7c36
commit
44df94eb98
6 files changed
+102
-26
No files matched your search
@@ -146,13 +146,13 @@ class GameFlowController
|
||||
$session = $this->request->session();
|
||||
$userId = $session->get('userId');
|
||||
$challengeToken_str = $this->request->query('challengeToken');
|
||||
$challenge = $this->challengeRepository->getByTokenStr($challengeToken_str);
|
||||
$userInChallenge = $this->userInChallengeRepository->getByUserIdAndToken($userId, $challengeToken_str);
|
||||
|
||||
if (!isset($challenge)) {
|
||||
if (!isset($userInChallenge)) {
|
||||
return new JsonContent(['error' => 'game_not_found']);
|
||||
}
|
||||
|
||||
$userInChallenge = $this->userInChallengeRepository->getByUserIdAndChallenge($userId, $challenge);
|
||||
$challenge = $userInChallenge->getChallenge();
|
||||
$currentRound = $userInChallenge->getRound();
|
||||
$currentPlace = $this->placeRepository->getByRoundInChallenge($challenge, $currentRound);
|
||||
|
||||
@@ -160,6 +160,7 @@ class GameFlowController
|
||||
|
||||
$response['history'] = [];
|
||||
|
||||
$allGuessesInChallenge = iterator_to_array($this->guessRepository->getAllInChallenge($challenge));
|
||||
$guessesByUser = iterator_to_array($this->guessRepository->getAllInChallengeByUser($userId, $challenge));
|
||||
$places = iterator_to_array($this->placeRepository->getAllInChallenge($challenge));
|
||||
|
||||
@@ -205,6 +206,9 @@ class GameFlowController
|
||||
|
||||
public function guess(): IContent
|
||||
{
|
||||
// testing
|
||||
$testPlace = $this->placeRepository->getByIdWithMap(5);
|
||||
|
||||
$mapId = (int) $this->request->query('mapId');
|
||||
$session = $this->request->session();
|
||||
|
||||
@@ -305,13 +309,13 @@ class GameFlowController
|
||||
$session = $this->request->session();
|
||||
$userId = $session->get('userId');
|
||||
$challengeToken_str = $this->request->query('challengeToken');
|
||||
$challenge = $this->challengeRepository->getByTokenStr($challengeToken_str);
|
||||
$userInChallenge = $this->userInChallengeRepository->getByUserIdAndToken($userId, $challengeToken_str);
|
||||
|
||||
if (!isset($challenge)) {
|
||||
if (!isset($userInChallenge)) {
|
||||
return new JsonContent(['error' => 'game_not_found']);
|
||||
}
|
||||
|
||||
$userInChallenge = $this->userInChallengeRepository->getByUserIdAndChallenge($userId, $challenge);
|
||||
$challenge = $userInChallenge->getChallenge();
|
||||
$currentRound = $userInChallenge->getRound();
|
||||
$currentPlace = $this->placeRepository->getByRoundInChallenge($challenge, $currentRound);
|
||||
$map = $this->mapRepository->getByPlace($currentPlace);
|
||||
|
||||
Reference in new issue
Block a user