diff --git a/webapp/src/Controller/API/ClarificationController.php b/webapp/src/Controller/API/ClarificationController.php index 81f1a560ca..397e2e499b 100644 --- a/webapp/src/Controller/API/ClarificationController.php +++ b/webapp/src/Controller/API/ClarificationController.php @@ -277,8 +277,10 @@ protected function getQueryBuilder(Request $request): QueryBuilder ->leftJoin('clar.sender', 's') ->leftJoin('clar.recipient', 'r') ->leftJoin('clar.problem', 'p') + ->innerJoin('c.problems', 'cp') ->select('clar, c, r, reply, p') ->andWhere('clar.contest = :cid') + ->andWhere('clar.problem IS NULL OR clar.problem = cp.problem') ->setParameter('cid', $this->getContestId($request)) ->orderBy('clar.clarid'); diff --git a/webapp/src/Controller/Jury/ClarificationController.php b/webapp/src/Controller/Jury/ClarificationController.php index 4c8a6f8fa1..4eda5224e2 100644 --- a/webapp/src/Controller/Jury/ClarificationController.php +++ b/webapp/src/Controller/Jury/ClarificationController.php @@ -193,7 +193,12 @@ public function viewAction(Request $request, int $id): Response $clarcontest = $contest->getShortname(); $data['subjectlink'] = null; if ($clar->getProblem()) { - $concernssubject = $contest->getCid() . "-" . $clar->getProblem()->getProbid(); + if ($clar->getContestProblem()) { + $concernssubject = $contest->getCid() . "-" . $clar->getProblem()->getProbid(); + } else { + // Very special case, this problem is unlinked. + $concernssubject = ""; + } $data['subjectlink'] = $this->generateUrl('jury_problem', ['probId' => $clar->getProblem()->getProbid()]); } elseif ($clar->getCategory()) { $concernssubject = $contest->getCid() . "-" . $clar->getCategory(); diff --git a/webapp/src/Twig/TwigExtension.php b/webapp/src/Twig/TwigExtension.php index c1309fe6b7..60df1de6cc 100644 --- a/webapp/src/Twig/TwigExtension.php +++ b/webapp/src/Twig/TwigExtension.php @@ -1179,9 +1179,9 @@ public function fileTypeIcon(string $type): string return 'fas fa-file-' . $iconName; } - public function problemBadge(ContestProblem $problem, bool $grayedOut = false): string + public function problemBadge(?ContestProblem $problem, bool $grayedOut = false): string { - $rgb = Utils::convertToHex($problem->getColor() ?? '#ffffff'); + $rgb = Utils::convertToHex($problem?->getColor() ?? '#ffffff'); if ($grayedOut || empty($rgb)) { $rgb = Utils::convertToHex('whitesmoke'); } @@ -1197,7 +1197,7 @@ public function problemBadge(ContestProblem $problem, bool $grayedOut = false): $rgb, $border, $foreground, - $problem->getShortname() + $problem?->getShortname() ?? '?' ); }