From 8f1a74fa690412b31348fb76fa801b98a3e32299 Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Fri, 22 Mar 2024 14:08:18 +0100 Subject: [PATCH] Show more specific warnings on config changes. - 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. --- .../src/Controller/Jury/ConfigController.php | 22 +++++++++++++++++-- webapp/src/Service/ConfigurationService.php | 5 +++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/webapp/src/Controller/Jury/ConfigController.php b/webapp/src/Controller/Jury/ConfigController.php index 8005ae6173..bbddc76be7 100644 --- a/webapp/src/Controller/Jury/ConfigController.php +++ b/webapp/src/Controller/Jury/ConfigController.php @@ -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 { diff --git a/webapp/src/Service/ConfigurationService.php b/webapp/src/Service/ConfigurationService.php index 65457f168a..1eae90956e 100644 --- a/webapp/src/Service/ConfigurationService.php +++ b/webapp/src/Service/ConfigurationService.php @@ -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. *