Merge branch 'master' of https://codefirst.iut.uca.fr/git/jade.van_brabandt/3.01-QCM_MuscuMaths
continuous-integration/drone/push Build is passing Details

pull/37/head
BelsethUwU 1 year ago
commit 9bd50abba1

@ -228,6 +228,16 @@ 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);
} else { } else {
$_SESSION["Questions"][$numQuestion]->setNbFails($_SESSION["Questions"][$numQuestion]->getNbFails() + 1); $_SESSION["Questions"][$numQuestion]->setNbFails($_SESSION["Questions"][$numQuestion]->getNbFails() + 1);
$this->mdQuestion->updateNbFails($_SESSION["Questions"][$numQuestion]);
}
if($_SESSION["Questions"][$numQuestion]->getNbFails() >= 25){
if($_SESSION["Questions"][$numQuestion]->getDifficulty() < 3){
$_SESSION["Questions"][$numQuestion]->setDifficulty($_SESSION["Questions"][$numQuestion]->getDifficulty() + 1);
}
$_SESSION["Questions"][$numQuestion]->setNbFails(0);
$this->mdQuestion->updateDifficulty($_SESSION["Questions"][$numQuestion]);
$this->mdQuestion->updateNbFails($_SESSION["Questions"][$numQuestion]);
} }
if ($numQuestion <= 8) { if ($numQuestion <= 8) {

@ -62,6 +62,29 @@ class GatewayQuestion
); );
} }
public function updateNbFails($question){
var_dump($question);
$query = "UPDATE questions SET nbfails = :nbfails WHERE id = :id;";
$this->con->executeQuery(
$query,
array(
':nbfails' => array($question->getNbFails(), PDO::PARAM_INT),
':id' => array($question->getId(), PDO::PARAM_INT),
)
);
}
public function updateDifficulty($question){
$query = "UPDATE questions SET difficulty = :difficulty WHERE id = :id;";
$this->con->executeQuery(
$query,
array(
':difficulty' => array($question->getDifficulty(), PDO::PARAM_INT),
':id' => array($question->getId(), PDO::PARAM_INT),
)
);
}
public function deleteQuestionByID($id) public function deleteQuestionByID($id)
{ {
$query = "DELETE FROM questions WHERE id = :id;"; $query = "DELETE FROM questions WHERE id = :id;";

@ -70,6 +70,14 @@ class ModelQuestion
$this->gwQuestion->updateQuestion($id, $questionDataArray); $this->gwQuestion->updateQuestion($id, $questionDataArray);
} }
function updateNbFails($question){
$this->gwQuestion->updateNbFails($question);
}
function updateDifficulty($question){
$this->gwQuestion->updateDifficulty($question);
}
function getQuestionsByChapterAndDifficulty($chapter, $difficulty) function getQuestionsByChapterAndDifficulty($chapter, $difficulty)
{ {
$questionsDataArray = $this->gwQuestion->getQuestionsByChapterAndDifficulty($chapter, $difficulty); $questionsDataArray = $this->gwQuestion->getQuestionsByChapterAndDifficulty($chapter, $difficulty);

@ -14,16 +14,21 @@
Retour Retour
</a> </a>
</div> </div>
<div class="container mt-5"> <div class="container mt-5 fs-4 text-light text-center">
<div class="col-5 bg-light border border-warning rounded"> <div class="row gy-2 mt-0 justify-content-center">
<p> Player Nickname : </p> <div class="col-3 bg-secondary border rounded">
<p>{{ player.nickname }} </p> <p> Player Nickname : </p>
<p>{{ player.nickname }} </p>
</div>
</div> </div>
{% for maxscore in maxscores %} {% for maxscore in maxscores %}
<div class="col-5 bg-light border border-warning rounded"> <div class="row gy-2 mt-0 justify-content-center">
<p> Maxscore pour le chapitre {{ maxscore["chapter"] }} : </p> <div class="col-3 bg-secondary border rounded">
<p>{{ maxscore["maxscore"] }} </p> <p> Maxscore pour le chapitre {{ maxscore["chapter"] }} : </p>
<p>{{ maxscore["maxscore"] }} </p>
</div>
</div> </div>
{% endfor %} {% endfor %}
</div>
</body> </body>
</html> </html>
Loading…
Cancel
Save