1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-04 00:02:50 +02:00

Suppression de contenu inutile pour les correspondances

This commit is contained in:
galaxyoyo
2019-09-11 18:41:45 +02:00
parent 07e7b94f5c
commit 340be7faf5
34 changed files with 86 additions and 1985 deletions

View File

@ -33,7 +33,7 @@ if (isset($_POST["team_edit"])) {
}
if (isset($_POST["request_validation"])) {
if (!canValidate($team, $tournament))
if (!canValidate($team))
$error_message = "Votre équipe ne peut pas demander la validation : il manque soit des participants, soit des documents.";
else
$_SESSION["team"]->setValidationStatus(ValidationStatus::WAITING);
@ -47,7 +47,7 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"]
$user = $_SESSION["user"];
$team = $_SESSION["team"];
//$documents = $user->getAllDocuments($team->getTournamentId());
$documents = $user->getAllDocuments($team->getProblem());
}
else
require_once "server_files/403.php";
@ -75,7 +75,7 @@ class SendDocument
public function sendDocument()
{
global $LOCAL_PATH, $DB, $FINAL;
global $LOCAL_PATH, $DB;
do
$id = genRandomPhrase(64);
@ -84,9 +84,9 @@ class SendDocument
if (!rename($this->file["tmp_name"], "$LOCAL_PATH/files/$id"))
throw new AssertionError("Une erreur est survenue lors de l'envoi du fichier.");
$req = $DB->prepare("INSERT INTO `documents`(`file_id`, `user`, `team`, `tournament`, `type`)
$req = $DB->prepare("INSERT INTO `documents`(`file_id`, `user`, `team`, `problem`, `type`)
VALUES (?, ?, ?, ?, ?);");
$req->execute([$id, $_SESSION["user_id"], $_SESSION["team"]->getId(), $_SESSION["team"]->isSelectedForFinal() ? $FINAL->getId() : $_SESSION["team"]->getTournamentId(), $this->type]);
$req->execute([$id, $_SESSION["user_id"], $_SESSION["team"]->getId(), $_SESSION["team"]->getProblem(), $this->type]);
}
}
@ -94,9 +94,9 @@ class MyTeam
{
public $name;
public $trigram;
public $tournament_id;
public $problem;
/** @var Team */
private $team;
private $tournament;
public function __construct($data)
{
@ -105,7 +105,6 @@ class MyTeam
$this->trigram = strtoupper($this->trigram);
$this->team = $_SESSION["team"];
$this->tournament = Tournament::fromId($this->tournament_id);
}
public function makeVerifications()
@ -114,8 +113,8 @@ class MyTeam
ensure($this->name == $this->team->getName() || !teamExists($this->name), "Une équipe existe déjà avec ce nom.");
ensure(preg_match("#^[A-Z]{3}$#", $this->trigram), "Le trigramme n'est pas valide.");
ensure($this->trigram == $this->team->getTrigram() || !trigramExists($this->trigram), "Une équipe a déjà choisi ce trigramme.");
ensure($this->tournament != null, "Le tournoi indiqué n'existe pas.");
ensure(date("y-m-d H:i:s") <= $this->tournament->getInscriptionDate(), "Les inscriptions sont terminées.");
ensure(preg_match("#^[1-4]$#", $this->problem), "Le problème indiqué n'existe pas.");
// ensure(date("y-m-d H:i:s") <= $this->tournament->getInscriptionDate(), "Les inscriptions sont terminées.");
ensure($this->team->getValidationStatus() == ValidationStatus::NOT_READY, "Votre équipe est déjà validée ou en cours de validation.");
}
@ -125,9 +124,7 @@ class MyTeam
$this->team->setName($this->name);
$this->team->setTrigram($this->trigram);
$this->team->setTournamentId($this->tournament_id);
$_SESSION["tournament"] = $this->tournament;
$this->team->setProblem($this->problem);
header("Location: $URL_BASE/mon_equipe");
}