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

Loading…
Cancel
Save