Skip to content

Commit

Permalink
Render contest validation errors more nicely. Fixes #2891
Browse files Browse the repository at this point in the history
  • Loading branch information
meisterT committed Feb 28, 2025
1 parent 1b1261d commit 2642394
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions webapp/src/Service/CheckConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,16 +472,23 @@ public function checkContestsValidate(): ConfigCheckItem
foreach ($contest->getProblems() as $cp) {
if (empty($cp->getColor())) {
$result = ($result === 'E' ? 'E' : 'W');
$cperrors[$cid] .= "No color for problem " . $cp->getShortname() . " in contest c" . $cid . "\n";
$cperrors[$cid] .= " - No color for problem " . $cp->getShortname() . " in contest c" . $cid . "\n";
}
}
}

$desc = '';
foreach ($contesterrors as $cid => $errors) {
$desc .= "Contest: c$cid: " .
/* @phpstan-ignore-next-line */
(count($errors) == 0 ? 'no errors' : (string)$errors) ."\n" .$cperrors[$cid];
$desc .= "Contest: c$cid: ";
if (count($errors) == 0 && empty($cperrors[$cid])) {
$desc .= "no errors\n";
} else {
$desc .= "errors:\n";
foreach ($errors as $error) {
$desc .= " - " . $error->getPropertyPath() . ": " . $error->getMessage() . "\n";
}
$desc .= $cperrors[$cid];
}
}

$this->stopwatch->stop(__FUNCTION__);
Expand Down

0 comments on commit 2642394

Please sign in to comment.