diff --git a/server_files/controllers/equipe.php b/server_files/controllers/equipe.php
index 3e584e0..629b6dd 100644
--- a/server_files/controllers/equipe.php
+++ b/server_files/controllers/equipe.php
@@ -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());
diff --git a/server_files/controllers/mon_equipe.php b/server_files/controllers/mon_equipe.php
index c03c540..5af190f 100644
--- a/server_files/controllers/mon_equipe.php
+++ b/server_files/controllers/mon_equipe.php
@@ -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";
diff --git a/server_files/controllers/solutions.php b/server_files/controllers/solutions.php
index 1e8f53c..0357130 100644
--- a/server_files/controllers/solutions.php
+++ b/server_files/controllers/solutions.php
@@ -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;
diff --git a/server_files/controllers/syntheses.php b/server_files/controllers/syntheses.php
index 06f78b0..05886ee 100644
--- a/server_files/controllers/syntheses.php
+++ b/server_files/controllers/syntheses.php
@@ -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;
diff --git a/server_files/model.php b/server_files/model.php
index 79390e7..717b938 100644
--- a/server_files/model.php
+++ b/server_files/model.php
@@ -1,8 +1,8 @@
getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "
";
}
if ($team->isSelectedForFinal()) {
- $final_name = $_SESSION["final"]->getName();
+ $final_name = $FINAL->getName();
echo "Équipe sélectionnée pour la finale nationale.";
}
?>
diff --git a/server_files/views/mon_equipe.php b/server_files/views/mon_equipe.php
index 150c77d..4ff5259 100644
--- a/server_files/views/mon_equipe.php
+++ b/server_files/views/mon_equipe.php
@@ -33,7 +33,7 @@ for ($i = 1; $i <= 6; ++$i) {
?>
Code d'accès : = $team->getAccessCode() ?>
isSelectedForFinal()) {
- $final_name = $_SESSION["final"]->getName();
+ $final_name = $FINAL->getName();
echo "Équipe sélectionnée pour la finale nationale.
";
} ?>
@@ -120,7 +120,7 @@ Code d'accès : = $team->getAccessCode() ?>