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