Skip to content

Commit

Permalink
Show more specific warnings on config changes.
Browse files Browse the repository at this point in the history
- Only when scoring related options changed, one needs to refresh the
  scoreboard cache.
- When you change a judging related option, you should rejudge affected
  submissions.

As a follow-up improvement we should add a rejudging filter for all
relevant submissions (we already display it on individual submissions)
and allow rejudging all affected with one button click.
  • Loading branch information
meisterT committed Mar 22, 2024
1 parent 8fead6b commit 8f1a74f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
22 changes: 20 additions & 2 deletions webapp/src/Controller/Jury/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,26 @@ public function indexAction(EventLogService $eventLogService, Request $request):
}

if (empty($errors)) {
$this->addFlash('scoreboard_refresh', 'After changing specific ' .
'settings, you might need to refresh the scoreboard.');
$needsRefresh = false;
$needsRejudging = false;
foreach ($diffs as $key => $diff) {
$category = $this->config->getCategory($key);
if ($category === 'Scoring') {
$needsRefresh = true;
}
if ($category === 'Judging') {
$needsRejudging = true;
}
}

if ($needsRefresh) {
$this->addFlash('scoreboard_refresh', 'After changing specific ' .
'scoring related settings, you might need to refresh the scoreboard (cache).');
}
if ($needsRejudging) {
$this->addFlash('danger', 'After changing specific ' .
'judging related settings, you might need to rejudge affected submissions.');
}

return $this->redirectToRoute('jury_config', ['diffs' => json_encode($diffs)]);
} else {
Expand Down
5 changes: 5 additions & 0 deletions webapp/src/Service/ConfigurationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public function get(string $name, bool $onlyIfPublic = false)
return $value;
}

public function getCategory(string $name): string
{
return $this->getConfigSpecification()[$name]->category;
}

/**
* Get all the configuration values, indexed by name.
*
Expand Down

0 comments on commit 8f1a74f

Please sign in to comment.