1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 02:06:52 +00:00

4 à 6 participants par équipe => 3 à 5

This commit is contained in:
galaxyoyo 2019-09-12 14:11:59 +02:00
parent 7ef88be38c
commit 762797142b
5 changed files with 8 additions and 8 deletions

View File

@ -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"];

View File

@ -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()

View File

@ -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;

View File

@ -11,7 +11,7 @@ if ($team->getEncadrantId() !== null) {
$id = $encadrant->getId();
echo "Encadrant : <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
}
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]);

View File

@ -18,7 +18,7 @@ if ($team->getEncadrantId() !== null) {
$id = $encadrant->getId();
echo "Encadrant : <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
}
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]);