Test calcul classement
continuous-integration/drone/push Build is failing Details

ServeurDeTest
Noé GARNIER 2 years ago
parent 71aebe1432
commit 95ee6cd658

@ -309,13 +309,13 @@ class ResoudreGateway
$query="SELECT classement FROM Resoudre $query="SELECT classement FROM Resoudre
WHERE enigme=:enigme WHERE enigme=:enigme
AND partie=:partie AND partie=:partie
ORDER BY classement DESC LIMIT 1"; ORDER BY classement";
$this->con->executeQuery($query, array( $this->con->executeQuery($query, array(
"enigme" => array($enigmeId, SQLITE3_INTEGER), "enigme" => array($enigmeId, SQLITE3_INTEGER),
"partie" => array($idPartie, SQLITE3_INTEGER))); "partie" => array($idPartie, SQLITE3_INTEGER)));
$results=$this->con->getResults(); $results=$this->con->getResults();
if (empty($results) || $results[0]['classement'] == null) { if (empty($results) || $results[0]['classement'] == null) {
return array(0); return array(null);
} }
foreach ($results as $row) { foreach ($results as $row) {
$classement[] = $row['classement']; $classement[] = $row['classement'];

@ -127,17 +127,12 @@ class UserModel
$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);
$leClassement = $this->resoudre_gateway->getClassement($enigmeId, $idPartie); $leClassement = $this->resoudre_gateway->getClassement($enigmeId, $idPartie);
if ($leClassement[0] == 0){ for ($i = 0; $i < $playerNumberPerGame; $i++){
$classement = 1; if ($leClassement[$i] == null || $leClassement[$i] != $i + 1){
}
else{
for ($i = 1; $i < $playerNumberPerGame; $i++){
if ($leClassement[$i] == null){
$classement = $i + 1; $classement = $i + 1;
break; break;
} }
} }
}
// if ($result == 0){ // if ($result == 0){
// $classement = 1; // $classement = 1;
// } // }

Loading…
Cancel
Save