fix : score if player not connected
continuous-integration/drone/push Build is passing Details

pull/37/head
Yvan CALATAYUD 1 year ago
parent 5eb99e060f
commit c2217039c1

@ -282,18 +282,14 @@ class ControllerUser
'idplayer' => $_SESSION["idPlayerConnected"], 'idplayer' => $_SESSION["idPlayerConnected"],
'maxscore' => $_SESSION["Score"] 'maxscore' => $_SESSION["Score"]
]; ];
// var_dump($jouer);
// var_dump($this->mdPlayer->verifyJouer($jouer));
// var_dump($this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer));
// var_dump($jouer['maxscore']);
// var_dump($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer));
// var_dump($jouer['maxscore'] >= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer));
if($_SESSION["idPlayerConnected"] != null){
if ($this->mdPlayer->verifyJouer($jouer) == null) { if ($this->mdPlayer->verifyJouer($jouer) == null) {
$this->mdPlayer->addJouer($jouer); $this->mdPlayer->addJouer($jouer);
} else if ($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)) { } else if ($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)) {
$this->mdPlayer->updateJouer($jouer); $this->mdPlayer->updateJouer($jouer);
} }
}
echo $this->twig->render($this->vues["viewScore"], [ echo $this->twig->render($this->vues["viewScore"], [
'score' => (int) $_SESSION["Score"], 'score' => (int) $_SESSION["Score"],
@ -344,11 +340,13 @@ class ControllerUser
'maxscore' => $_SESSION["Score"] 'maxscore' => $_SESSION["Score"]
]; ];
if($_SESSION["idPlayerConnected"] != null){
if ($this->mdPlayer->verifyJouer($jouer) == null) { if ($this->mdPlayer->verifyJouer($jouer) == null) {
$this->mdPlayer->addJouer($jouer); $this->mdPlayer->addJouer($jouer);
} else if ($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)) { } else if ($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)) {
$this->mdPlayer->updateJouer($jouer); $this->mdPlayer->updateJouer($jouer);
} }
}
echo $this->twig->render($this->vues["viewScore"], [ echo $this->twig->render($this->vues["viewScore"], [
'score' => $_SESSION["Score"], 'score' => $_SESSION["Score"],

Loading…
Cancel
Save