1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-26 00:27:32 +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());