From 74b59ece7e4f1c5c71434bca7e833c67d7c74966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Garnier?= Date: Thu, 12 Jan 2023 16:44:52 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20de=20bug=20qui=20r=C3=A9duisait=20?= =?UTF-8?q?le=20temps=20des=20parties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WEB/Controller/PartieGateway.php | 8 ++++++++ WEB/Controller/UserController.php | 3 +++ WEB/Model/UserModel.php | 3 +++ 3 files changed, 14 insertions(+) diff --git a/WEB/Controller/PartieGateway.php b/WEB/Controller/PartieGateway.php index dc0c91f0..284bbb59 100644 --- a/WEB/Controller/PartieGateway.php +++ b/WEB/Controller/PartieGateway.php @@ -365,6 +365,14 @@ class PartieGateway } return true; } + public function majDateDebut(int $idPartie){ + $query = "UPDATE Partie SET dateDebut = :dateDebut WHERE id = :idPartie"; + $this->con->executeQuery($query, array( + "idPartie" => array($idPartie, SQLITE3_INTEGER), + "dateDebut" => array(date("Y-m-d H:i:s"), SQLITE3_TEXT) + ) + ); + } public function showAll(): void { $query = "SELECT * FROM Partie"; diff --git a/WEB/Controller/UserController.php b/WEB/Controller/UserController.php index 126c193d..6a56604b 100644 --- a/WEB/Controller/UserController.php +++ b/WEB/Controller/UserController.php @@ -261,6 +261,9 @@ class UserController $points = $model->getPointsAtTheEnd($utilisateur->getEmail(), $idPartie); require($rep . $vues['lobbyEnd']); } else { + if ($index == 1 ){ + $model->majDateDebut($idPartie); + } $enigme = $model->getEnigmebyPartieIdAndIndex($idPartie, $index); $model->resoudreEnigmeMulti($utilisateur, $enigme->getIdEnigme(), $idPartie, $index); $code = $model->getCode($utilisateur->getEmail(), $enigme->getIdEnigme()); diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index c2ef7569..493a1ff1 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -244,4 +244,7 @@ class UserModel public function checkUserIsInPartie(string $mailUtilisateur) : bool{ return $this->partie_gateway->checkUserIsInPartie($mailUtilisateur); } + public function majDateDebut(int $idPartie) { + $this->partie_gateway->majDateDebut($idPartie); + } } \ No newline at end of file