diff --git a/server_files/classes/Question.php b/server_files/classes/Question.php index a45fb6e..f49ab8b 100644 --- a/server_files/classes/Question.php +++ b/server_files/classes/Question.php @@ -3,6 +3,13 @@ class Question { + const DEFAULT_QUESTIONS = ["Comment avez-vous obtenu vos résultats ?", + "Peut-on rendre votre algorithme plus efficace ? Pourquoi ?", + "Comment élargir vos travaux ?", + null, + null, + null]; + private $id; private $from; private $to; @@ -73,15 +80,9 @@ class Question } if (sizeof($questions) == 0) { - $default_questions = ["Comment avez-vous obtenu vos résultats ?", - "Peut-on rendre votre algorithme plus efficace ? Pourquoi ?", - "Comment élargir vos travaux ?", - null, - null, - null]; for ($i = 0; $i < 6; ++$i) { $req = $DB->prepare("INSERT INTO `questions`(`from`, `to`, `problem`, `number`, `question`) VALUES (?, ?, ?, ?, ?);"); - $req->execute([$from->getId(), $to->getId(), $from->getProblem(), $i, $default_questions[$i]]); + $req->execute([$from->getId(), $to->getId(), $from->getProblem(), $i, self::DEFAULT_QUESTIONS[$i]]); } return self::getQuestions($from, $to); } diff --git a/server_files/controllers/suivi_tournoi.php b/server_files/controllers/suivi_tournoi.php index 6117ef1..61c39a7 100644 --- a/server_files/controllers/suivi_tournoi.php +++ b/server_files/controllers/suivi_tournoi.php @@ -52,5 +52,59 @@ $videos = []; for ($problem = 1; $problem <= 4; ++$problem) $videos[] = Video::getVideos(Reason::SOLUTION, $problem); +$waiting_teams = []; + +switch (Phase::getCurrentPhase()) { + case Phase::PHASE1: + $req = $DB->query("SELECT DISTINCT `teams`.`id` FROM `teams` WHERE `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'" + . " AND `id` NOT IN (SELECT DISTINCT `team` FROM `videos` WHERE `reason` = 'SOLUTION' AND `validation` = " . Video::ACCEPTED . ")" + . " AND `year` = $YEAR;"); + break; + case Phase::PHASE2: + $req = $DB->query("SELECT DISTINCT `teams`.`id` FROM `teams`" + . " WHERE `id` NOT IN (SELECT `q1`.`from` FROM `questions` AS `q1`" + . " JOIN `questions` AS `q2` ON `q2`.`from` = `q1`.`from` AND `q2`.`number` = 1" + . " JOIN `questions` AS `q3` ON `q3`.`from` = `q1`.`from` AND `q3`.`number` = 2" + . " JOIN `questions` AS `q4` ON `q4`.`from` = `q1`.`from` AND `q4`.`number` = 3" + . " JOIN `questions` AS `q5` ON `q5`.`from` = `q1`.`from` AND `q5`.`number` = 4" + . " JOIN `questions` AS `q6` ON `q6`.`from` = `q1`.`from` AND `q6`.`number` = 5" + . " WHERE `q1`.`question` != '" . Question::DEFAULT_QUESTIONS[0] . "'" + . " OR `q2`.`question` != '" . Question::DEFAULT_QUESTIONS[1] . "'" + . " OR `q3`.`question` != '" . Question::DEFAULT_QUESTIONS[2] . "'" + . " OR `q4`.`question` IS NOT NULL" + . " OR `q5`.`question` IS NOT NULL" + . " OR `q6`.`question` IS NOT NULL)" + . " AND `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'" + . " AND `year` = $YEAR;"); + break; + case Phase::PHASE3: + $req = $DB->query("SELECT DISTINCT `teams`.`id` FROM `teams`" + . " WHERE `id` NOT IN (SELECT `q1`.`to` FROM `questions` AS `q1`" + . " JOIN `questions` AS `q2` ON `q2`.`to` = `q1`.`to` AND `q2`.`number` = 1" + . " JOIN `questions` AS `q3` ON `q3`.`to` = `q1`.`to` AND `q3`.`number` = 2" + . " JOIN `questions` AS `q4` ON `q4`.`to` = `q1`.`to` AND `q4`.`number` = 3" + . " JOIN `questions` AS `q5` ON `q5`.`to` = `q1`.`to` AND `q5`.`number` = 4" + . " JOIN `questions` AS `q6` ON `q6`.`to` = `q1`.`to` AND `q6`.`number` = 5" + . " WHERE `q1`.`answer` IS NOT NULL" + . " OR `q2`.`answer` IS NOT NULL" + . " OR `q3`.`answer` IS NOT NULL" + . " OR `q4`.`answer` IS NOT NULL" + . " OR `q5`.`answer` IS NOT NULL" + . " OR `q6`.`answer` IS NOT NULL)" + . " AND `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'" + . " AND `year` = $YEAR;"); + break; + case Phase::PHASE4: + $req = $DB->query("SELECT DISTINCT `teams`.`id` FROM `teams` WHERE `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'" + . " AND (`id` NOT IN (SELECT DISTINCT `team` FROM `videos` WHERE `reason` = 'ANSWER1' AND `validation` = " . Video::ACCEPTED . ")" + . " OR `id` NOT IN (SELECT DISTINCT `team` FROM `videos` WHERE `reason` = 'ANSWER2' AND `validation` = " . Video::ACCEPTED . "))" + . " AND `year` = $YEAR;"); + break; +} + +if (isset($req)) { + while (($data = $req->fetch()) !== false) + $waiting_teams[] = Team::fromId($data["id"]); +} require_once "server_files/views/suivi_tournoi.php"; \ No newline at end of file diff --git a/server_files/services/mail_templates/new_answer.html b/server_files/services/mail_templates/new_answer.html index 8832d29..59aa9d2 100644 --- a/server_files/services/mail_templates/new_answer.html +++ b/server_files/services/mail_templates/new_answer.html @@ -10,7 +10,7 @@ Bonjour {FIRST_NAME} {SURNAME},
L'équipe « {TEAM_NAME} » ({TRIGRAM}) vient d'ajouter une vidéo de réponse destinée à l'équipe « {DEST_TEAM_NAME} » ({DEST_TRIGRAM}) pour le problème {PROBLEM} des Correspondances des Jeunes Mathématicien·ne·s : {VIDEO_LINK}. Vous êtes désormais invité avant que quelqu'un d'autre ne le fasse à accepter ou refuser cette vidéo via la plateforme d'inscription (accessible après connexion) : -{URL_BASE}/videos-solutions
+{URL_BASE}/suivi-tournoi

Cordialement,

diff --git a/server_files/services/mail_templates/new_video.html b/server_files/services/mail_templates/new_video.html index 6c78a80..9b96351 100644 --- a/server_files/services/mail_templates/new_video.html +++ b/server_files/services/mail_templates/new_video.html @@ -9,7 +9,7 @@ Bonjour {FIRST_NAME} {SURNAME},

L'équipe « {TEAM_NAME} » ({TRIGRAM}) vient d'ajouter une vidéo pour le problème {PROBLEM} des Correspondances des Jeunes Mathématicien·ne·s : {VIDEO_LINK}. Vous êtes désormais invité avant que quelqu'un d'autre ne le fasse à accepter ou refuser cette vidéo via la plateforme d'inscription (accessible après connexion) : -{URL_BASE}/videos-solutions
+{URL_BASE}/suivi-tournoi

Cordialement,

diff --git a/server_files/views/equipe.php b/server_files/views/equipe.php index 4f68dba..fb9f7c2 100644 --- a/server_files/views/equipe.php +++ b/server_files/views/equipe.php @@ -42,7 +42,7 @@ if ($_SESSION["role"] == Role::ADMIN) { ?>
getValidationStatus() == ValidationStatus::VALIDATED) { ?> -
diff --git a/server_files/views/index.php b/server_files/views/index.php index 9cfd21d..a18eaf2 100644 --- a/server_files/views/index.php +++ b/server_files/views/index.php @@ -5,8 +5,8 @@

- Bienvenue sur le site d'inscription aux Correspondances - des Jeunes Mathématicien·ne·s ! + Bienvenue sur le site d'inscription aux Correspondances + des Jeunes Mathématicien·ne·s !

diff --git a/server_files/views/suivi_tournoi.php b/server_files/views/suivi_tournoi.php index b06e031..d7956c9 100644 --- a/server_files/views/suivi_tournoi.php +++ b/server_files/views/suivi_tournoi.php @@ -6,6 +6,23 @@ require_once "header.php";

Suivi du tournoi

+ 0) { ?> +
+ pas encore participé à la phase en cours : + +
+ +