test
continuous-integration/drone/push Build is passing Details

ServeurDeTest
Noé GARNIER 2 years ago
parent fa3e241041
commit 5ebc49153d

@ -144,6 +144,25 @@ class ResoudreGateway
return $results[0]['ended'];
}
}
public function checkEnigmeIsEndedInPartie(string $mailUtilisateur, int $enigmeId, int $idPartie){
$query="SELECT * FROM Resoudre
WHERE utilisateur=:utilisateur
AND enigme=:enigme
AND partie=:partie";
$this->con->executeQuery($query, array(
"utilisateur" => array($mailUtilisateur, SQLITE3_TEXT),
"enigme" => array($enigmeId, SQLITE3_INTEGER),
"partie" => array($idPartie, SQLITE3_INTEGER)));
$results=$this->con->getResults();
if(empty($results))
{
return false;
}
else
{
return $results[0]['ended'];
}
}
public function checkPartieIsAlreadyCreate(int $enigmeId) : bool{
$query="SELECT * FROM Resoudre

@ -249,7 +249,6 @@ class UserController
$lastIndex = $model->getLastIndex($idPartie);
if ($lastIndex != 0 && $index == $lastIndex + 1) {
if ($model->checkGameIsEnd($idPartie)) {
echo" end";
$this->endGame();
return;
}

@ -219,7 +219,7 @@ class UserModel
$lesIdEnigmes = $this->partie_gateway->getLesIdEnigmes($idPartie);
foreach ($lesMailJoueurs as $mail){
foreach ($lesIdEnigmes as $idEnigme){
if ($this->resoudre_gateway->checkEnigmeIsEnded($mail, $idEnigme) == false){
if ($this->resoudre_gateway->checkEnigmeIsEndedInPartie($mail, $idEnigme, $idPartie) == false){
return false;
}
}

Loading…
Cancel
Save