Skip to content

Commit 0071234

Browse files
committed
Warn jury for clarifications before contest start
There are good reasons to already send the clarification, so we don't disable the feature but warn the user.
1 parent cf2478c commit 0071234

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

webapp/src/Controller/Jury/ClarificationController.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,30 @@ public function __construct(
3434
protected readonly EventLogService $eventLogService
3535
) {}
3636

37+
private function warnClarificationBeforeContestStart(): void
38+
{
39+
$cc = $this->dj->getCurrentContest();
40+
$message = "Generic clarifications are visible before contest start.";
41+
if ($cc && $cc->getStartTime() > Utils::now()) {
42+
$this->addFlash('warning', $message);
43+
} elseif (!$cc) {
44+
foreach ($this->dj->getCurrentContests() as $cc) {
45+
if ($cc->getStartTime() > Utils::now()) {
46+
$this->addFlash('warning', $message);
47+
return;
48+
}
49+
}
50+
}
51+
}
52+
3753
#[Route(path: '', name: 'jury_clarifications')]
3854
public function indexAction(
3955
#[MapQueryParameter(name: 'filter')]
4056
?string $currentFilter = null,
4157
#[MapQueryParameter(name: 'queue')]
4258
string $currentQueue = 'all',
4359
): Response {
60+
$this->warnClarificationBeforeContestStart();
4461
$categories = $this->config->get('clar_categories');
4562
if ($contest = $this->dj->getCurrentContest()) {
4663
$contestIds = [$contest->getCid()];
@@ -116,6 +133,7 @@ public function indexAction(
116133
#[Route(path: '/{id<\d+>}', name: 'jury_clarification')]
117134
public function viewAction(Request $request, int $id): Response
118135
{
136+
$this->warnClarificationBeforeContestStart();
119137
$clarification = $this->em->getRepository(Clarification::class)->find($id);
120138
if (!$clarification) {
121139
throw new NotFoundHttpException(sprintf('Clarification with ID %s not found', $id));
@@ -239,6 +257,7 @@ public function composeClarificationAction(
239257
#[MapQueryParameter]
240258
?string $teamto = null,
241259
): Response {
260+
$this->warnClarificationBeforeContestStart();
242261
$formData = ['recipient' => JuryClarificationType::RECIPIENT_MUST_SELECT];
243262

244263
if ($teamto !== null) {

0 commit comments

Comments
 (0)