1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-02-06 12:13:01 +00:00

Meilleur aperçu des équipes en retard

This commit is contained in:
Yohann 2020-01-01 21:11:28 +01:00
parent b44c789dc8
commit eb53514eb9
3 changed files with 14 additions and 3 deletions

View File

@ -199,6 +199,11 @@ class Team
$DB->prepare("UPDATE `teams` SET `validation_status` = ? WHERE `id` = ?;")->execute([ValidationStatus::getName($status), $this->id]); $DB->prepare("UPDATE `teams` SET `validation_status` = ? WHERE `id` = ?;")->execute([ValidationStatus::getName($status), $this->id]);
} }
public function getSolution()
{
return Video::getVideo(Reason::SOLUTION, $this);
}
public function getVideoTeamIds() public function getVideoTeamIds()
{ {
return $this->video_team_ids; return $this->video_team_ids;

View File

@ -58,11 +58,13 @@ $waiting_emails = [];
switch (Phase::getCurrentPhase()) { switch (Phase::getCurrentPhase()) {
case Phase::PHASE1: case Phase::PHASE1:
case Phase::PHASE12:
$req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams` WHERE `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'" $req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` 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 `id` NOT IN (SELECT DISTINCT `team` FROM `videos` WHERE `reason` = 'SOLUTION' AND `validation` = " . Video::ACCEPTED . ")"
. " AND `year` = $YEAR ORDER BY `problem`, `trigram`;"); . " AND `year` = $YEAR ORDER BY `problem`, `trigram`;");
break; break;
case Phase::PHASE2: case Phase::PHASE2:
case Phase::PHASE23:
$req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams`" $req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams`"
. " WHERE `id` NOT IN (SELECT `q1`.`from` FROM `questions` AS `q1`" . " WHERE `id` NOT IN (SELECT `q1`.`from` FROM `questions` AS `q1`"
. " JOIN `questions` AS `q2` ON `q2`.`from` = `q1`.`from` AND `q2`.`number` = 2" . " JOIN `questions` AS `q2` ON `q2`.`from` = `q1`.`from` AND `q2`.`number` = 2"
@ -81,6 +83,7 @@ switch (Phase::getCurrentPhase()) {
. " AND `year` = $YEAR ORDER BY `problem`, `trigram`;"); . " AND `year` = $YEAR ORDER BY `problem`, `trigram`;");
break; break;
case Phase::PHASE3: case Phase::PHASE3:
case Phase::PHASE34:
$req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams`" $req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams`"
. " WHERE `id` NOT IN (SELECT `q1`.`to` FROM `questions` AS `q1`" . " WHERE `id` NOT IN (SELECT `q1`.`to` FROM `questions` AS `q1`"
. " JOIN `questions` AS `q2` ON `q2`.`to` = `q1`.`to` AND `q2`.`number` = 2" . " JOIN `questions` AS `q2` ON `q2`.`to` = `q1`.`to` AND `q2`.`number` = 2"
@ -99,6 +102,7 @@ switch (Phase::getCurrentPhase()) {
. " AND `year` = $YEAR ORDER BY `problem`, `trigram`;"); . " AND `year` = $YEAR ORDER BY `problem`, `trigram`;");
break; break;
case Phase::PHASE4: case Phase::PHASE4:
case Phase::END:
$req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams` WHERE `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'" $req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` 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 . ")" . " 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 . "))" . " OR `id` NOT IN (SELECT DISTINCT `team` FROM `videos` WHERE `reason` = 'ANSWER2' AND `validation` = " . Video::ACCEPTED . "))"
@ -110,6 +114,8 @@ if (isset($req)) {
$waiting_emails = []; $waiting_emails = [];
while (($data = $req->fetch()) !== false) { while (($data = $req->fetch()) !== false) {
$team = Team::fromId($data["id"]); $team = Team::fromId($data["id"]);
if (Phase::getCurrentPhase() >= Phase::PHASE12 && $team->getSolution() == null)
continue;
$waiting_teams[] = $team; $waiting_teams[] = $team;
$waiting_emails = array_merge($waiting_emails, $team->getAllEmails()); $waiting_emails = array_merge($waiting_emails, $team->getAllEmails());
} }

View File

@ -9,12 +9,12 @@ require_once "header.php";
<?php <?php
if (sizeof($waiting_teams) > 0) { ?> if (sizeof($waiting_teams) > 0) { ?>
<div class="alert alert-warning"> <div class="alert alert-warning">
<?= sizeof($waiting_teams) == 1 ? "L'équipe suivante n'a" : "Les équipes suivantes n'ont" ?> pas encore participé à la phase en cours : <?= sizeof($waiting_teams) == 1 ? "L'équipe suivante n'a" : "Les équipes suivantes n'ont" ?> pas encore participé à la phase en cours, ou leurs vidéos n'ont pas encore été validées :
<ul> <ul>
<?php <?php
foreach ($waiting_teams as $team) { ?> foreach ($waiting_teams as $team) { ?>
<li> <li>
<a href="/equipe/<?= $team->getTrigram() ?>"> <a href="#team-<?= $team->getTrigram() ?>">
Équipe <?= $team->getName() ?> (<?= $team->getTrigram() ?>) Équipe <?= $team->getName() ?> (<?= $team->getTrigram() ?>)
</a> </a>
</li> </li>
@ -40,7 +40,7 @@ for ($problem = 1; $problem <= 4; ++$problem) { ?>
?> ?>
<div class="jumbotron" id="team-<?= $team->getTrigram() ?>"> <div class="jumbotron" id="team-<?= $team->getTrigram() ?>">
<h2> <h2>
Équipe « <?= $team->getName() ?> » (<?= $team->getTrigram() ?>) <a style="color: black" href="/equipe/<?= $team->getTrigram() ?>">Équipe « <?= $team->getName() ?> » (<?= $team->getTrigram() ?>)</a>
</h2> </h2>
<div class="alert alert-info"> <div class="alert alert-info">
<strong>Lien de la vidéo (version <?= $version ?>) :</strong> <a href="<?= $link ?>"><?= $link ?></a> <strong>Lien de la vidéo (version <?= $version ?>) :</strong> <a href="<?= $link ?>"><?= $link ?></a>