|
|
@ -125,7 +125,6 @@ class UserModel
|
|
|
|
$now = new DateTime();
|
|
|
|
$now = new DateTime();
|
|
|
|
$interval = $now->diff($dateDebut);
|
|
|
|
$interval = $now->diff($dateDebut);
|
|
|
|
$tempDeResolution = $interval->days * 24 * 60 * 60 + $interval->h * 60 * 60 + $interval->i * 60 + $interval->s;
|
|
|
|
$tempDeResolution = $interval->days * 24 * 60 * 60 + $interval->h * 60 * 60 + $interval->i * 60 + $interval->s;
|
|
|
|
// $result = $this->resoudre_gateway->getMaxClassement($enigmeId, $idPartie);
|
|
|
|
|
|
|
|
$leClassement = $this->resoudre_gateway->getClassement($enigmeId, $idPartie);
|
|
|
|
$leClassement = $this->resoudre_gateway->getClassement($enigmeId, $idPartie);
|
|
|
|
usort($leClassement, function($leClassement, $b) {
|
|
|
|
usort($leClassement, function($leClassement, $b) {
|
|
|
|
if ($leClassement === $b) {
|
|
|
|
if ($leClassement === $b) {
|
|
|
@ -145,12 +144,6 @@ class UserModel
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if ($result == 0){
|
|
|
|
|
|
|
|
// $classement = 1;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// else{
|
|
|
|
|
|
|
|
// $classement = $result + 1;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
$this->resoudre_gateway->enigmeMultiEnded($mailUtilisateur,$enigmeId, $idPartie ,$tempDeResolution, $classement);
|
|
|
|
$this->resoudre_gateway->enigmeMultiEnded($mailUtilisateur,$enigmeId, $idPartie ,$tempDeResolution, $classement);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -284,10 +277,15 @@ class UserModel
|
|
|
|
public function skipEnigme(string $mailUtilisateur, int $idPartie, int $idEnigme) {
|
|
|
|
public function skipEnigme(string $mailUtilisateur, int $idPartie, int $idEnigme) {
|
|
|
|
$this->resoudre_gateway->skipEnigme($mailUtilisateur, $idPartie, $idEnigme);
|
|
|
|
$this->resoudre_gateway->skipEnigme($mailUtilisateur, $idPartie, $idEnigme);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// public function quitGame(string $mailUtilisateur, int $idPartie) {
|
|
|
|
public function quitGame(string $mailUtilisateur, int $idPartie) {
|
|
|
|
// $this->partie_gateway->quitGame($mailUtilisateur, $idPartie);
|
|
|
|
$lesIdEnigmes = $this->partie_gateway->getLesIdEnigmes($idPartie);
|
|
|
|
// if ($this->partie_gateway->getPlayerNumber($idPartie) == 0){
|
|
|
|
foreach ($lesIdEnigmes as $idEnigme){
|
|
|
|
// $this->partie_gateway->delete($idPartie);
|
|
|
|
if ($this->resoudre_gateway->checkEnigmeIsEndedInPartie($mailUtilisateur, $idEnigme, $idPartie) == false){
|
|
|
|
// }
|
|
|
|
$this->resoudre_gateway->skipEnigme($mailUtilisateur, $idPartie, $idEnigme);
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->partie_gateway->getPlayerNumber($idPartie) == 0){
|
|
|
|
|
|
|
|
$this->partie_gateway->delete($idPartie);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|