|
|
@ -188,6 +188,7 @@ class UserModel
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getPointsAtTheEnd(string $mailUtilisateur, int $idPartie) : int{
|
|
|
|
public function getPointsAtTheEnd(string $mailUtilisateur, int $idPartie) : int{
|
|
|
|
|
|
|
|
global $playerNumberPerGame;
|
|
|
|
$points = 0;
|
|
|
|
$points = 0;
|
|
|
|
$result = $this->resoudre_gateway->getAllByPartieAndUtilisateur($mailUtilisateur, $idPartie);
|
|
|
|
$result = $this->resoudre_gateway->getAllByPartieAndUtilisateur($mailUtilisateur, $idPartie);
|
|
|
|
foreach ($result as $row){
|
|
|
|
foreach ($result as $row){
|
|
|
@ -197,9 +198,15 @@ class UserModel
|
|
|
|
else if ($row['classement'] == 2){
|
|
|
|
else if ($row['classement'] == 2){
|
|
|
|
$points += $this->enigme_gateway->findById($row['enigme'])[0]->getPoints() * 0.75;
|
|
|
|
$points += $this->enigme_gateway->findById($row['enigme'])[0]->getPoints() * 0.75;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else if ($row['classement'] == 3){
|
|
|
|
$points += $this->enigme_gateway->findById($row['enigme'])[0]->getPoints() * 0.5;
|
|
|
|
$points += $this->enigme_gateway->findById($row['enigme'])[0]->getPoints() * 0.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ($row['ended'] == 0){
|
|
|
|
|
|
|
|
$points += 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
$points += $this->enigme_gateway->findById($row['enigme'])[0]->getPoints() * 0.25;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $points;
|
|
|
|
return $points;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -254,4 +261,13 @@ class UserModel
|
|
|
|
$this->partie_gateway->delete($idPartie);
|
|
|
|
$this->partie_gateway->delete($idPartie);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function skipEnigme(string $mailUtilisateur, int $idPartie, int $idEnigme) {
|
|
|
|
|
|
|
|
$this->resoudre_gateway->skipEnigme($mailUtilisateur, $idPartie, $idEnigme);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// public function quitGame(string $mailUtilisateur, int $idPartie) {
|
|
|
|
|
|
|
|
// $this->partie_gateway->quitGame($mailUtilisateur, $idPartie);
|
|
|
|
|
|
|
|
// if ($this->partie_gateway->getPlayerNumber($idPartie) == 0){
|
|
|
|
|
|
|
|
// $this->partie_gateway->delete($idPartie);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|