Correction : enigmeMultiEnded +
continuous-integration/drone/push Build is failing Details

Calcul classement
ServeurDeTest
Noé GARNIER 2 years ago
parent 3b86256929
commit de7a867962

@ -189,32 +189,38 @@ class ResoudreGateway
"enigme" => array($enigmeId, SQLITE3_INTEGER),
"ended" => array(1, SQLITE3_INTEGER)));
}
public function enigmeMultiEnded(string $mailUtilisateur, int $enigmeId, int $tempDeResolution, $classement){
public function enigmeMultiEnded(string $mailUtilisateur, int $enigmeId, int $idPartie ,int $tempDeResolution, $classement){
$query="UPDATE Resoudre
SET ended=:ended
WHERE utilisateur=:utilisateur
AND enigme=:enigme";
AND enigme=:enigme
AND partie=:partie";
$this->con->executeQuery($query, array(
"utilisateur" => array($mailUtilisateur, SQLITE3_TEXT),
"enigme" => array($enigmeId, SQLITE3_INTEGER),
"partie" => array($idPartie, SQLITE3_INTEGER),
"ended" => array(1, SQLITE3_INTEGER)));
$query="UPDATE Resoudre
SET temps=:temps
WHERE utilisateur=:utilisateur
AND enigme=:enigme";
AND enigme=:enigme
AND partie=:partie";
$this->con->executeQuery($query, array(
"utilisateur" => array($mailUtilisateur, SQLITE3_TEXT),
"enigme" => array($enigmeId, SQLITE3_INTEGER),
"partie" => array($idPartie, SQLITE3_INTEGER),
"temps" => array($tempDeResolution, SQLITE3_INTEGER)));
$query="UPDATE Resoudre
SET classement=:classement
WHERE utilisateur=:utilisateur
AND enigme=:enigme";
AND enigme=:enigme
AND partie=:partie";
$this->con->executeQuery($query, array(
"utilisateur" => array($mailUtilisateur, SQLITE3_TEXT),
"enigme" => array($enigmeId, SQLITE3_INTEGER),
"partie" => array($idPartie, SQLITE3_INTEGER),
"classement" => array($classement, SQLITE3_INTEGER)));
}

@ -125,21 +125,21 @@ class UserModel
$now = new DateTime();
$interval = $now->diff($dateDebut);
$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);
// for ($i = 0; $i < $playerNumberPerGame; $i++){
// if ($leClassement[$i] == null || $leClassement[$i] != $i + 1){
// $classement = $i + 1;
// break;
// }
// }
if ($result == 0){
$classement = 1;
}
else{
$classement = $result + 1;
// $result = $this->resoudre_gateway->getMaxClassement($enigmeId, $idPartie);
$leClassement = $this->resoudre_gateway->getClassement($enigmeId, $idPartie);
for ($i = 0; $i < $playerNumberPerGame; $i++){
if ($leClassement[$i] == null || $leClassement[$i] != $i + 1){
$classement = $i + 1;
break;
}
}
$this->resoudre_gateway->enigmeMultiEnded($mailUtilisateur,$enigmeId, $tempDeResolution, $classement);
// if ($result == 0){
// $classement = 1;
// }
// else{
// $classement = $result + 1;
// }
$this->resoudre_gateway->enigmeMultiEnded($mailUtilisateur,$enigmeId, $idPartie ,$tempDeResolution, $classement);
}
public function saveCode(string $mailUtilisateur, int $enigmeId,string $code ){

Loading…
Cancel
Save