From 762797142b2e53debe00e0e8bf62233c47f500e9 Mon Sep 17 00:00:00 2001 From: galaxyoyo Date: Thu, 12 Sep 2019 14:11:59 +0200 Subject: [PATCH] =?UTF-8?q?4=20=C3=A0=206=20participants=20par=20=C3=A9qui?= =?UTF-8?q?pe=20=3D>=203=20=C3=A0=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server_files/classes/Team.php | 2 +- server_files/controllers/rejoindre_equipe.php | 4 ++-- server_files/model.php | 6 +++--- server_files/views/equipe.php | 2 +- server_files/views/mon_equipe.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server_files/classes/Team.php b/server_files/classes/Team.php index 3a7447c..fb1de50 100644 --- a/server_files/classes/Team.php +++ b/server_files/classes/Team.php @@ -67,7 +67,7 @@ class Team $this->trigram = $data["trigram"]; $this->problem = $data["problem"]; $this->encadrant = $data["encadrant"]; - $this->participants = [$data["participant_1"], $data["participant_2"], $data["participant_3"], $data["participant_4"], $data["participant_5"], $data["participant_6"]]; + $this->participants = [$data["participant_1"], $data["participant_2"], $data["participant_3"], $data["participant_4"], $data["participant_5"]]; $this->inscription_date = $data["inscription_date"]; $this->validation_status = ValidationStatus::fromName($data["validation_status"]); $this->access_code = $data["access_code"]; diff --git a/server_files/controllers/rejoindre_equipe.php b/server_files/controllers/rejoindre_equipe.php index 88ac93f..912a054 100644 --- a/server_files/controllers/rejoindre_equipe.php +++ b/server_files/controllers/rejoindre_equipe.php @@ -35,14 +35,14 @@ class JoinTeam ensure($this->team != null, "Ce code d'accès est invalide."); ensure($this->team->getValidationStatus() == ValidationStatus::NOT_READY, "Cette équipe est déjà validée ou en cours de validation, vous ne pouvez pas la rejoindre."); - for ($i = 1; $i <= $_SESSION["role"] == Role::PARTICIPANT ? 6 : 1; ++$i) { + for ($i = 1; $i <= $_SESSION["role"] == Role::PARTICIPANT ? 5 : 1; ++$i) { if (($_SESSION["role"] == Role::PARTICIPANT ? $this->team->getParticipants()[$i - 1] : $this->team->getEncadrantId()) == NULL) break; } $this->min_null_index = $i; - ensure($_SESSION["role"] == Role::PARTICIPANT && $this->min_null_index <= 6 || $_SESSION["role"] == Role::ENCADRANT && $this->min_null_index <= 2, "Il n'y a plus de place pour vous dans l'équipe."); + ensure($_SESSION["role"] == Role::PARTICIPANT && $this->min_null_index <= 5 || $_SESSION["role"] == Role::ENCADRANT && $this->min_null_index <= 2, "Il n'y a plus de place pour vous dans l'équipe."); } public function joinTeam() diff --git a/server_files/model.php b/server_files/model.php index 41d4be3..a22a0e1 100644 --- a/server_files/model.php +++ b/server_files/model.php @@ -49,7 +49,7 @@ function quitTeam() return; if ($role == Role::PARTICIPANT) - for ($i = 1; $i <= 6; ++$i) + for ($i = 1; $i <= 5; ++$i) /** @noinspection SqlResolve */ $DB->exec("UPDATE `teams` SET `participant_$i` = NULL WHERE `participant_$i` = $user_id;"); else @@ -102,7 +102,7 @@ function canValidate(Team $team) $can_validate = $team->getValidationStatus() == ValidationStatus::NOT_READY; $can_validate &= $team->getEncadrantId() != null; - $can_validate &= $team->getParticipants()[3] != null; + $can_validate &= $team->getParticipants()[2] != null; if ($team->getEncadrantId() != null) { $req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `user` = ? AND `problem` = ? AND `type` = ?;"); @@ -111,7 +111,7 @@ function canValidate(Team $team) $can_validate &= $d["version"] > 0; } - for ($i = 1; $i <= 6; ++$i) { + for ($i = 1; $i <= 5; ++$i) { if ($team->getParticipants()[$i] === NULL) continue; diff --git a/server_files/views/equipe.php b/server_files/views/equipe.php index a8c4ffd..1b2c857 100644 --- a/server_files/views/equipe.php +++ b/server_files/views/equipe.php @@ -11,7 +11,7 @@ if ($team->getEncadrantId() !== null) { $id = $encadrant->getId(); echo "Encadrant : getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "
"; } -for ($i = 1; $i <= 6; ++$i) { +for ($i = 1; $i <= 5; ++$i) { if ($team->getParticipants()[$i - 1] == NULL) continue; $participant = User::fromId($team->getParticipants()[$i - 1]); diff --git a/server_files/views/mon_equipe.php b/server_files/views/mon_equipe.php index 298508e..5735922 100644 --- a/server_files/views/mon_equipe.php +++ b/server_files/views/mon_equipe.php @@ -18,7 +18,7 @@ if ($team->getEncadrantId() !== null) { $id = $encadrant->getId(); echo "Encadrant : getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "
"; } -for ($i = 1; $i <= 6; ++$i) { +for ($i = 1; $i <= 5; ++$i) { if ($team->getParticipants()[$i - 1] == NULL) continue; $participant = User::fromId($team->getParticipants()[$i - 1]);