1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-01 22:01:18 +02:00

Support de la finale

This commit is contained in:
Yohann
2019-09-03 00:01:54 +02:00
parent 10da20f2c0
commit 39abeec4e6
10 changed files with 210 additions and 76 deletions

View File

@ -9,11 +9,11 @@ if (isset($_POST["send_solution"])) {
$error_message = saveSolution();
}
$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
$solutions_req->execute([$_SESSION["team_id"]]);
$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([$_SESSION["team_id"], $_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
$tournament_req = $DB->prepare("SELECT `date_solutions` FROM `tournaments` WHERE `id` = ?;");
$tournament_req->execute([$_SESSION["tournament_id"]]);
$tournament_req->execute([$_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
$tournament_data = $tournament_req->fetch();
function saveSolution() {
@ -52,8 +52,7 @@ function saveSolution() {
if (!rename($file["tmp_name"], "$LOCAL_PATH/files/$id"))
return "Une erreur est survenue lors de l'envoi du fichier.";
$req = $DB->prepare("INSERT INTO `solutions`(`file_id`, `team`, `tournament`, `problem`)
VALUES (?, ?, ?, ?);");
$req = $DB->prepare("INSERT INTO `solutions`(`file_id`, `team`, `tournament`, `problem`) VALUES (?, ?, ?, ?);");
$req->execute([$id, $_SESSION["team_id"], $_SESSION["tournament_id"], $problem]);
return false;
@ -74,14 +73,14 @@ function saveSolution() {
<?php if (date("yyyy-mm-dd") < $tournament_data["date_solutions"]) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
<table>
<table style="width: 100%;">
<tbody>
<tr>
<td>
<label for="problem">Problème :</label>
</td>
<td>
<select id="problem" name="problem">
<select style="width: 100%;" id="problem" name="problem">
<?php
for ($i = 1; $i <= 9; ++$i) {
echo "<option value=\"$i\">$i</option>\n";