Merge branch 'master' of https://codefirst.iut.uca.fr/git/nathan.boileau/Scripted
continuous-integration/drone/push Build is passing Details

ServeurDeTest
nathan boileau 2 years ago
commit b2c835d1e8

@ -122,6 +122,12 @@ class AdminController extends UserController
case "goToDashboard":
$this->goToDashboard();
break;
case "getPlayersPseudo":
$this->getPlayersPseudo();
break;
case "getDashboardInfo":
$this->getDashboardInfo();
break;
case "report":
$this->report();
break;

@ -342,29 +342,43 @@ class ResoudreGateway
$query = "UPDATE Resoudre
SET ended=:ended
WHERE utilisateur=:utilisateur
AND partie=:partie";
AND partie=:partie
AND enigme=:enigme";
$this->con->executeQuery($query, array(
"utilisateur" => array($mailUtilisateur, SQLITE3_TEXT),
"partie" => array($idPartie, SQLITE3_INTEGER),
"enigme" => array($idEnigme, SQLITE3_INTEGER),
"ended" => array(1, SQLITE3_INTEGER)));
$query = "UPDATE Resoudre
SET temps=:temps
WHERE utilisateur=:utilisateur
AND partie=:partie";
AND partie=:partie
AND enigme=:enigme";
$this->con->executeQuery($query, array(
"utilisateur" => array($mailUtilisateur, SQLITE3_TEXT),
"partie" => array($idPartie, SQLITE3_INTEGER),
"enigme" => array($idEnigme, SQLITE3_INTEGER),
"temps" => array(null, SQLITE3_NULL)));
$query = "UPDATE Resoudre
SET classement=:classement
WHERE utilisateur=:utilisateur
AND partie=:partie";
AND partie=:partie
AND enigme=:enigme";
$this->con->executeQuery($query, array(
"utilisateur" => array($mailUtilisateur, SQLITE3_TEXT),
"partie" => array($idPartie, SQLITE3_INTEGER),
"enigme" => array($idEnigme, SQLITE3_INTEGER),
"classement" => array($playerNumberPerGame, SQLITE3_INTEGER)));
}
public function cleanCodeAfterGame(int $idPartie) {
$query = "UPDATE Resoudre
SET code=:code
WHERE partie=:partie";
$this->con->executeQuery($query, array(
"partie" => array($idPartie, SQLITE3_INTEGER),
"code" => array('', SQLITE3_TEXT)));
}
}

@ -79,12 +79,6 @@ class UserController
case "getPlayersPseudo":
$this->getPlayersPseudo();
break;
case "getPlayersEmail":
$this->getPlayersEmail();
break;
case "getPlayerScore":
$this->getPlayerScore();
break;
case "getDashboardInfo":
$this->getDashboardInfo();
break;
@ -466,36 +460,6 @@ class UserController
require($rep . $vues['erreur']);
}
}
public function getPlayersEmail(){
try {
global $rep, $vues, $error;
$model = new UserModel();
$idPartie = $_SESSION['idPartie'];
$lesJoueurs = $model->getLesJoueurs($idPartie);
$lesJoueurs = json_encode($lesJoueurs);
echo $lesJoueurs;
}
catch (Exception $e) {
$error = $e->getMessage();
require($rep . $vues['erreur']);
}
}
public function getPlayerScore(){
try {
global $rep, $vues, $error;
$model = new UserModel();
$idPartie = $_SESSION['idPartie'];
$pseudo = $_POST['pseudo'];
$mailUtilisateur = $model->getMailFromPseudo($pseudo);
$score = $model->getPlayerScore($mailUtilisateur, $idPartie);
$score = json_encode($score);
echo $score;
}
catch (Exception $e) {
$error = $e->getMessage();
require($rep . $vues['erreur']);
}
}
public function getDashboardInfo(){
try {
global $rep, $vues, $error;

@ -205,10 +205,7 @@ class UserModel
$points = 0;
$result = $this->resoudre_gateway->getAllByPartieAndUtilisateur($mailUtilisateur, $idPartie);
foreach ($result as $row){
if ($row['temps'] == 0){
$points += 0;
}
else if ($row['ended'] == 0){
if ($row['temps'] == 0 || $row['ended'] == 0){
$points += 0;
}
else if ($row['classement'] == 1){
@ -261,6 +258,7 @@ class UserModel
return true;
}
public function endGame(int $idPartie) {
$this->resoudre_gateway->cleanCodeAfterGame($idPartie);
$this->partie_gateway->endGame($idPartie);
}

@ -34,8 +34,6 @@
},
axisY: {
title: "Point",
titleFontColor: "#6D78AD",
lineColor: "#6D78AD",
gridThickness: 0,
lineThickness: 1,
},

@ -18,7 +18,7 @@
<div class="d-flex flex-column align-items-center">
<h1>Partie Terminée !</h1>
<h2>Gagnant : <?php echo $lesInfos[3]->getPseudo() ?></h2>
<p>Bien joué à tous la partie est finis, voici le classement :</p>
<p>Bien joué à tous la partie est fini, voici le classement :</p>
</div>
<table class="table">
<thead class="text-center">

@ -18,7 +18,7 @@
</div>
<div class="row">
<div class="col-12 d-flex flex-column align-items-center">
<p>Vous avez terminer toute les énimges.</p>
<p>Vous avez terminé toutes les énigmes.</p>
<p>Votre score est de : <?php echo $points ?> points.</p>
<p>Temps restant avant la fin de la partie :</p>
<?php

Loading…
Cancel
Save