From 1915004e6b8b203ab7c16f765de4356b622499a8 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 17:45:35 +0100 Subject: [PATCH 01/10] =?UTF-8?q?ajout=20d'un=20texte=20pour=20que=20?= =?UTF-8?q?=C3=A7a=20marche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WEB/View/src/pages/Multijoueur/Partie.php | 1 + 1 file changed, 1 insertion(+) diff --git a/WEB/View/src/pages/Multijoueur/Partie.php b/WEB/View/src/pages/Multijoueur/Partie.php index aa9cf90e..0e3d7ae1 100644 --- a/WEB/View/src/pages/Multijoueur/Partie.php +++ b/WEB/View/src/pages/Multijoueur/Partie.php @@ -3,5 +3,6 @@ +vous ĂȘtes dans la partie \ No newline at end of file From 3c2de54e23af378518e17694a6a2443b452e52ec Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 17:51:43 +0100 Subject: [PATCH 02/10] test de isAlreadyInQueue --- WEB/Model/UserModel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index db08600e..4f7aeab1 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -25,6 +25,7 @@ class UserModel public function addToQueue() { echo '1'; + echo "$this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur']"; if ($this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur'])) { if($this->utilisateur_gateway->queueFilled()) { From 66335c72e0e520d7496f4ef3f8169f21c44407aa Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 17:55:49 +0100 Subject: [PATCH 03/10] test --- WEB/Model/UserModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index 4f7aeab1..a6fec282 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -25,7 +25,7 @@ class UserModel public function addToQueue() { echo '1'; - echo "$this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur']"; + var_dump($this->utilisateur_gateway->isAlreadyInQueue($_SESSION['utilisateur'])); if ($this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur'])) { if($this->utilisateur_gateway->queueFilled()) { From f6aa6e44c766737478c4b6dc413f0a61d1260b33 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 17:57:05 +0100 Subject: [PATCH 04/10] trouvaille de l'erreur oublie d'un return --- WEB/Metier/Partie.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WEB/Metier/Partie.php b/WEB/Metier/Partie.php index 804f3250..53477d75 100644 --- a/WEB/Metier/Partie.php +++ b/WEB/Metier/Partie.php @@ -44,7 +44,7 @@ class Partie } /** - * @param array $datePartie + * @param dateTime $datePartie */ public function setDatePartie(dateTime $datePartie): void { From 7b9ce824a2395bcd02cbea112226181e6d264cce Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 17:57:51 +0100 Subject: [PATCH 05/10] oublie d'un return et rajout de celui-ci --- WEB/Model/UserModel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index a6fec282..a4094b26 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -30,6 +30,7 @@ class UserModel if($this->utilisateur_gateway->queueFilled()) { $_REQUEST['action']='launchGame'; + return; } } echo '2'; From c81876ac6c3b77db8af1fcd29beca1436af33816 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 18:00:08 +0100 Subject: [PATCH 06/10] reparation --- WEB/Model/UserModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index a4094b26..13bf2a35 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -30,8 +30,8 @@ class UserModel if($this->utilisateur_gateway->queueFilled()) { $_REQUEST['action']='launchGame'; - return; } + return; } echo '2'; if (!$this->partie_gateway->partieInQueueExists()) { From 1cd70726102e42773ba5c938418a0475d84fdf86 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 18:02:33 +0100 Subject: [PATCH 07/10] changement pour des tests --- WEB/Controller/UtilisateurGateway.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WEB/Controller/UtilisateurGateway.php b/WEB/Controller/UtilisateurGateway.php index 0404b4a9..64f7dac7 100644 --- a/WEB/Controller/UtilisateurGateway.php +++ b/WEB/Controller/UtilisateurGateway.php @@ -112,7 +112,7 @@ class UtilisateurGateway public function queueFilled(){ $query = "SELECT count(*) FROM Participer WHERE etat=0"; $this->con->executeQuery($query); - if ($this->con->getResults()[0]['count(*)'] >= 4) + if ($this->con->getResults()[0]['count(*)'] >= 2) return True; else return False; From 9d0bf46defc266a4cf84c3c904bfc74c6f698c50 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 18:14:28 +0100 Subject: [PATCH 08/10] corrections --- WEB/Controller/PartieGateway.php | 3 ++- WEB/Controller/UserController.php | 8 +++----- WEB/Model/UserModel.php | 4 ++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/WEB/Controller/PartieGateway.php b/WEB/Controller/PartieGateway.php index 0e983213..1230cc56 100644 --- a/WEB/Controller/PartieGateway.php +++ b/WEB/Controller/PartieGateway.php @@ -66,7 +66,8 @@ class PartieGateway $query = "SELECT p.id FROM Partie p, Participer pa WHERE pa.etat=0 - AND pa.partie=p.id"; + AND pa.partie=p.id + LIMIT 1"; $this->con->executeQuery($query); $results = $this->con->getResults(); return $results[0]['id']; diff --git a/WEB/Controller/UserController.php b/WEB/Controller/UserController.php index 1fbc508b..15f2a79f 100644 --- a/WEB/Controller/UserController.php +++ b/WEB/Controller/UserController.php @@ -205,12 +205,10 @@ class UserController require($rep . $vues['queue']); $model = new UserModel(); $model->addToQueue(); + $usergroup = $model->findUserGroup(); echo - ''; } + public function findUserGroup() : int { + return $this->partie_gateway->findPartieInQueue(); + } + public function launchGame() { $this->utilisateur_gateway->launchGame($_SESSION['utilisateur']); From 41ef365fadb9a289423612040d641dfa596eddf0 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 18:16:24 +0100 Subject: [PATCH 09/10] =?UTF-8?q?v=C3=A9rification=20de=20queueFilled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WEB/Model/UserModel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index 001bc976..bfb17138 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -27,6 +27,7 @@ class UserModel echo '1'; var_dump($this->utilisateur_gateway->isAlreadyInQueue($_SESSION['utilisateur'])); if ($this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur'])) { + var_dump($this->utilisateur_gateway->queueFilled()); if($this->utilisateur_gateway->queueFilled()) { $_REQUEST['action']='launchGame'; From dffcca8afd4f0b2ea860c38d0f9999c1d88458a2 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 3 Jan 2023 18:20:09 +0100 Subject: [PATCH 10/10] =?UTF-8?q?v=C3=A9rification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WEB/Model/UserModel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index bfb17138..e600477c 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -31,6 +31,7 @@ class UserModel if($this->utilisateur_gateway->queueFilled()) { $_REQUEST['action']='launchGame'; + var_dump($_REQUEST['action']); } return; }