fix : ups
continuous-integration/drone/push Build is passing Details

pull/37/head
Jade VAN BRABANDT 1 year ago
parent bc67e2fe0d
commit d64ab6c94b

@ -93,7 +93,7 @@ class ControllerUser
$difficultyIsOk = TRUE; $difficultyIsOk = TRUE;
$chapterIsOk = TRUE; $chapterIsOk = TRUE;
if (!($difficulty == 0 or $difficulty == 1 or $difficulty == 2)) { if (!($difficulty == 1 or $difficulty == 2 or $difficulty == 3)) {
$_SESSION["error"] = "Valeur de difficulté invalide"; $_SESSION["error"] = "Valeur de difficulté invalide";
$difficultyIsOk = FALSE; $difficultyIsOk = FALSE;
} }
@ -144,7 +144,7 @@ class ControllerUser
$_SESSION["Score"] = $_SESSION["Score"] + 80 + 40 * ((30 - $time->s) / 100 * 10 / 3); $_SESSION["Score"] = $_SESSION["Score"] + 80 + 40 * ((30 - $time->s) / 100 * 10 / 3);
} }
if ($numQuestion <= 1) { if ($numQuestion <= 8) {
$_SESSION["PrevTime"] = $_SESSION["CurrTime"]; $_SESSION["PrevTime"] = $_SESSION["CurrTime"];
echo $this->twig->render($this->vues["singleplayer"], [ echo $this->twig->render($this->vues["singleplayer"], [
'questions' => $_SESSION["Questions"], 'questions' => $_SESSION["Questions"],
@ -183,7 +183,8 @@ class ControllerUser
function passer() function passer()
{ {
$numQuestion = $_POST["numQuestion"]; $numQuestion = $_POST["numQuestion"];
if ($numQuestion <= 2) { $_SESSION["playerAnswersContent"][$numQuestion] = "Pas de réponse";
if ($numQuestion <= 8) {
$_SESSION["PrevTime"] = $_SESSION["CurrTime"]; $_SESSION["PrevTime"] = $_SESSION["CurrTime"];
echo $this->twig->render($this->vues["singleplayer"], [ echo $this->twig->render($this->vues["singleplayer"], [
'questions' => $_SESSION["Questions"], 'questions' => $_SESSION["Questions"],
@ -191,15 +192,30 @@ class ControllerUser
'answerss' => $_SESSION["Answers"], 'answerss' => $_SESSION["Answers"],
]); ]);
} else { } else {
$goodAnswer = array(); $Final = array();
$Final[]["Question"] = array();
$Final[]["goodAnswer"] = array();
$Final[]["PlayerAnswer"] = array();
$c=0;
foreach ($_SESSION["Questions"] as &$question) { foreach ($_SESSION["Questions"] as &$question) {
$answer = $this->mdAnswer->getAnswerByID($question['idanswergood']); $answer = $this->mdAnswer->getAnswerByID($question->getIdAnswerGood());
$goodAnswer[] = $answer->getContent(); $Final[$c]["goodAnswer"] = $answer->getContent();
$c=$c+1;
}
$c=0;
foreach ($_SESSION["Questions"] as $question) {
$Final[$c]["Question"] = $question->getContent();
$c=$c+1;
}
$c=0;
foreach ($_SESSION["playerAnswersContent"] as $answer)
{
$Final[$c]["PlayerAnswer"] = $answer;
$c=$c+1;
} }
echo $this->twig->render($this->vues["viewScore"], [ echo $this->twig->render($this->vues["viewScore"], [
'score' => $_SESSION["Score"], 'score' => $_SESSION["Score"],
'questions' => $_SESSION["Questions"], 'Final' => $Final,
'answerss' => $_SESSION["Answers"],
]); ]);
} }
} }

Loading…
Cancel
Save