From 18e8a8d5c46a774eae786ce95eeed535d68cd308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Garnier?= Date: Mon, 9 Jan 2023 10:00:13 +0100 Subject: [PATCH] Correction --- WEB/Controller/EnigmeGateway.php | 3 +++ WEB/Controller/PartieGateway.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/WEB/Controller/EnigmeGateway.php b/WEB/Controller/EnigmeGateway.php index 67a8dd85..481deda5 100644 --- a/WEB/Controller/EnigmeGateway.php +++ b/WEB/Controller/EnigmeGateway.php @@ -175,6 +175,9 @@ class EnigmeGateway $query = "SELECT * FROM Enigme WHERE ordre = 0 ORDER BY RANDOM() LIMIT 1"; $this->con->executequery($query); $results = $this->con->getResults(); + if (empty($results)){ + throw new Exception("Aucune énigme mulitijoeur n'est disponible"); + } $tabEnigme=EnigmeFactory::create($results); return $tabEnigme[0]; } diff --git a/WEB/Controller/PartieGateway.php b/WEB/Controller/PartieGateway.php index 2c6d1a72..4571f09e 100644 --- a/WEB/Controller/PartieGateway.php +++ b/WEB/Controller/PartieGateway.php @@ -251,12 +251,14 @@ class PartieGateway throw new Exception("La partie est pleine"); } if ($player + 1 == $playerNumberPerGame) { + echo "La partie est pleine"; $query = "INSERT INTO Participer VALUES (:partie,:utilisateur,1)"; $this->con->executeQuery($query, array( "partie" => array($idPartie, SQLITE3_INTEGER), "utilisateur" => array($mailUtilisateur, SQLITE3_TEXT))); } else { + echo "La partie n'est pas pleine"; $query = "INSERT INTO Participer VALUES (:partie,:utilisateur,0)"; $this->con->executeQuery($query, array( "partie" => array($idPartie, SQLITE3_INTEGER),