Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions webapp/src/Controller/API/ClarificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ protected function getQueryBuilder(Request $request): QueryBuilder
}
}

// For non-API-reader users, only expose the problems after the contest has started.
// `WF Access Policy` allows for clarifications before the contest, but not to disclose the problem
// so referencing them in clarifications would violate referential integrity.
if (!$this->dj->checkrole('api_reader')) {
$queryBuilder->andWhere('c.starttime < :now OR clar.problem IS NULL')
->setParameter('now', Utils::now());
}

if ($request->query->has('problem')) {
$queryBuilder
->andWhere('clar.problem = :problem')
Expand Down
14 changes: 8 additions & 6 deletions webapp/src/Controller/Team/MiscController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
use App\Controller\BaseController;
use App\DataTransferObject\SubmissionRestriction;
use App\Entity\Clarification;
use App\Entity\Language;
use App\Form\Type\PrintType;
use App\Service\ConfigurationService;
use App\Service\DOMJudgeService;
use App\Service\EventLogService;
use App\Service\ScoreboardService;
use App\Service\SubmissionService;
use App\Utils\Utils;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
Expand Down Expand Up @@ -92,8 +92,7 @@ public function homeAction(Request $request): Response
paginated: false
)[0];

/** @var Clarification[] $clarifications */
$clarifications = $this->em->createQueryBuilder()
$qb = $this->em->createQueryBuilder()
->from(Clarification::class, 'c')
->leftJoin('c.problem', 'p')
->leftJoin('c.sender', 's')
Expand All @@ -105,9 +104,12 @@ public function homeAction(Request $request): Response
->setParameter('contest', $contest)
->setParameter('team', $team)
->addOrderBy('c.submittime', 'DESC')
->addOrderBy('c.clarid', 'DESC')
->getQuery()
->getResult();
->addOrderBy('c.clarid', 'DESC');
if (!$this->dj->checkrole('jury') && $contest->getStartTimeObject()->getTimestamp() > time()) {
$qb->andWhere('c.problem IS NULL');
}
/** @var Clarification[] $clarifications */
$clarifications = $qb->getQuery()->getResult();

/** @var Clarification[] $clarificationRequests */
$clarificationRequests = $this->em->createQueryBuilder()
Expand Down
4 changes: 4 additions & 0 deletions webapp/templates/team/partials/index_content.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<h2 id="contestnotstarted" class="text-center">
Contest {{ contest | printContestStart }}
</h2>
{% if clarifications is not empty %}
<h1 class="teamoverview">Clarifications</h1>
{% include 'team/partials/clarification_list.html.twig' with {clarifications: clarifications} %}
{% endif %}
{% else %}

<div id="teamscoresummary">
Expand Down
Loading