Correction
continuous-integration/drone/push Build is failing Details

ServeurDeTest
Noé GARNIER 2 years ago
parent 0757dc838d
commit 564d17678c

@ -79,8 +79,8 @@ class UserController
case "getPlayersPseudo":
$this->getPlayersPseudo();
break;
case "getPlayers":
$this->getPlayers();
case "getPlayersEmail":
$this->getPlayersEmail();
break;
case "getPlayerScore":
$this->getPlayerScore();
@ -464,12 +464,12 @@ class UserController
require($rep . $vues['erreur']);
}
}
public function getPlayers(){
public function getPlayersEmail(){
try {
global $rep, $vues, $error;
$model = new UserModel();
$idPartie = $_SESSION['idPartie'];
$lesJoueurs = $model->getPlayers($idPartie);
$lesJoueurs = $model->getPlayersEmail($idPartie);
$lesJoueurs = json_encode($lesJoueurs);
echo $lesJoueurs;
}

@ -294,20 +294,15 @@ class UserModel
}
return $lesPseudos;
}
public function getPlayers(int $idPartie) : array{
public function getPlayersEmail(int $idPartie) : array{
$lesJoueurs = $this->getLesJoueurs($idPartie);
$lesPseudo = array();
foreach ($lesJoueurs as $joueur){
$lesPseudo[] = $this->utilisateur_gateway->getPseudoByEmail($joueur);
}
return array($lesJoueurs, $lesPseudo);
return $lesJoueurs;
}
public function getPlayerScore(string $mailUtilisateur,int $idPartie) : array{
global $playerNumberPerGame;
$score = array();
$result = $this->resoudre_gateway->getAllByPartieAndUtilisateur($mailUtilisateur, $idPartie);
foreach ($result as $row){
$points = 0;
if ($row['temps'] == 0){
$score[] = 0;
}

@ -1,21 +1,29 @@
function dashboard () {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayers', true);
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayersEmail', true);
xhr.responseType = 'text';
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var players = xhr.onload = function () {
var playersEmail = xhr.onload = function () {
return JSON.parse(xhr.responseText);
};
xhr.send(null);
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayersPseudo', true);
xhr.responseType = 'text';
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var playersPseudo = xhr.onload = function () {
return JSON.parse(xhr.responseText);
}
data = [];
if (players[1][0] != null) {
if (playersEmail[0] != null) {
v1 = {}
v1.type="line";
v1.xValueFormatString=players[1][0];
v1.xValueFormatString=playersPseudo[0];
v1.dataPoints=[];
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. players[0][0], true);
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[0], true);
xhr.responseType = 'text';
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var score = xhr.onload = function () {
@ -30,13 +38,13 @@ function dashboard () {
// v.dataPoints.push({x:0,y:0});
// v.dataPoints.push({x:0.5,y:300});
if (players[1][1] != null) {
if (playersEmail[1] != null) {
v2 = {}
v2.type="line";
v2.xValueFormatString=players[1][1];
v2.xValueFormatString=playersPseudo[1];
v2.dataPoints=[];
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. players[0][1], true);
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[1], true);
xhr.responseType = 'text';
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var score = xhr.onload = function () {
@ -49,13 +57,13 @@ function dashboard () {
data.push(v2);
}
if (players[1][2] != null) {
if (playersEmail[2] != null) {
v3 = {}
v3.type="line";
v3.xValueFormatString=players[1][2];
v3.xValueFormatString=playersPseudo[2];
v3.dataPoints=[];
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. players[0][2], true);
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[2], true);
xhr.responseType = 'text';
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var score = xhr.onload = function () {
@ -68,13 +76,13 @@ function dashboard () {
data.push(v3);
}
if (players[1][3] != null) {
if (playersEmail[3] != null) {
v4 = {}
v4.type="line";
v4.xValueFormatString=players[1][3];
v4.xValueFormatString=playersPseudo[3];
v4.dataPoints=[];
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. players[0][3], true);
xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[3], true);
xhr.responseType = 'text';
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var score = xhr.onload = function () {

Loading…
Cancel
Save