1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-30 11:11:14 +02:00

Le tournoi de la finale nationale est désormais une variable globale

This commit is contained in:
galaxyoyo
2019-09-07 14:31:28 +02:00
parent cb760cb059
commit 25a31b7f40
7 changed files with 15 additions and 15 deletions

View File

@ -17,9 +17,9 @@ if (isset($_POST["validate"])) {
if (isset($_POST["select"])) {
$team->selectForFinal(true);
$team->setValidationStatus(ValidationStatus::NOT_READY);
$_SESSION["final"] = Tournament::getFinalTournament();
$sols_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
/** @noinspection SqlAggregates */
$sols_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem` ORDER BY `problem`, `uploaded_at` DESC;");
$sols_req->execute([$team->getId(), $team->getTournamentId()]);
while (($sol_data = $sols_req->fetch()) !== false) {
$old_id = $sol_data["file_id"];
@ -57,7 +57,7 @@ if (isset($_POST["select"])) {
copy("$LOCAL_PATH/files/$old_id", "$LOCAL_PATH/files/$id");
$req = $DB->prepare("INSERT INTO `syntheses`(`file_id`, `team`, `tournament`, `dest`) VALUES (?, ?, ?, ?);");
$req->execute([$id, $team->getId(), $_SESSION["final"]->getId(), $synthese_data["dest"]]);
$req->execute([$id, $team->getId(), $FINAL->getId(), $synthese_data["dest"]]);
}
}
@ -66,7 +66,7 @@ $documents_req->execute([$team->getId(), $team->getId()]);
if ($team->isSelectedForFinal()) {
$documents_final_req = $DB->prepare("SELECT `file_id`, `user`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `team` = ? AND `tournament` != ? GROUP BY `user`, `type` ORDER BY `user`, `type` ASC, MAX(`uploaded_at`) DESC;");
$documents_final_req->execute([$team->getId(), $_SESSION["final"]->getId()]);
$documents_final_req->execute([$team->getId(), $FINAL->getId()]);
}
$tournament = Tournament::fromId($team->getTournamentId());

View File

@ -25,7 +25,7 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"]
$tournament = Tournament::fromId($team->getTournamentId());
$documents_req = $DB->prepare("SELECT `file_id`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `user` = ? AND `tournament` = ? GROUP BY `type`, `uploaded_at` ORDER BY `type`, `uploaded_at` DESC;");
$documents_req->execute([$_SESSION["user_id"], $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $tournament->getId()]]);
$documents_req->execute([$_SESSION["user_id"], $_SESSION[$team->isSelectedForFinal() ? $FINAL->getId() : $tournament->getId()]]);
}
else
require_once "server_files/403.php";

View File

@ -11,9 +11,9 @@ if (isset($_POST["send_solution"])) {
$team = $_SESSION["team"];
$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
$solutions_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId()]]);
$solutions_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId()]]);
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId());
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId());
function saveSolution() {
global $LOCAL_PATH, $DB;

View File

@ -11,9 +11,9 @@ if (isset($_POST["send_synthese"])) {
$team = $_SESSION["team"];
$syntheses_req = $DB->prepare("SELECT `file_id`, `dest`, COUNT(`dest`) AS `version` FROM `syntheses` WHERE `team` = ? AND `tournament` = ? GROUP BY `dest`, `uploaded_at` ORDER BY `dest`, `uploaded_at` DESC;");
$syntheses_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId()]]);
$syntheses_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId()]]);
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId());
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId());
function saveSynthese() {
global $LOCAL_PATH, $DB;