Corection du calcul du temps de résolution
continuous-integration/drone/push Build is passing Details

ServeurDeTest
Noé GARNIER 2 years ago
parent b85b57cf3f
commit d370898f6b

@ -45,7 +45,6 @@ class UserModel
public function calculTpsMaXPartie( int $idPartie) : int { public function calculTpsMaXPartie( int $idPartie) : int {
$lesIdEnigmes = $this->partie_gateway->findAllEnigmeIdInPartie($idPartie); $lesIdEnigmes = $this->partie_gateway->findAllEnigmeIdInPartie($idPartie);
var_dump($lesIdEnigmes);
foreach ($lesIdEnigmes as $idEnigme){ foreach ($lesIdEnigmes as $idEnigme){
$enigme = $this->enigme_gateway->findById($idEnigme)[0]; $enigme = $this->enigme_gateway->findById($idEnigme)[0];
$tpsMaxPartie += $enigme->getTempsDeResolution(); $tpsMaxPartie += $enigme->getTempsDeResolution();
@ -109,9 +108,8 @@ class UserModel
public function enigmeMultiEnded(string $mailUtilisateur, int $enigmeId){ public function enigmeMultiEnded(string $mailUtilisateur, int $enigmeId){
$idPartie = $_SESSION['idPartie']; $idPartie = $_SESSION['idPartie'];
$dateDebut = $this->partie_gateway->getDateDebut($idPartie); $dateDebut = $this->partie_gateway->getDateDebut($idPartie);
$end_time = $dateDebut->modify('+'. $_SESSION['tpsMaxPartie'] .'seconds');
$now = new DateTime(); $now = new DateTime();
$interval = $now->diff($end_time); $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); $result = $this->resoudre_gateway->getMaxClassement($enigmeId, $idPartie);
if ($result == 0){ if ($result == 0){

Loading…
Cancel
Save