Skip to content

Commit 80234e9

Browse files
committed
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.
1 parent 8fead6b commit 80234e9

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

webapp/src/Controller/Jury/ConfigController.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,26 @@ public function indexAction(EventLogService $eventLogService, Request $request):
8585
}
8686

8787
if (empty($errors)) {
88-
$this->addFlash('scoreboard_refresh', 'After changing specific ' .
89-
'settings, you might need to refresh the scoreboard.');
88+
$needsRefresh = false;
89+
$needsRejudging = false;
90+
foreach ($diffs as $key => $diff) {
91+
$category = $this->config->getCategory($key);
92+
if ($category === 'Scoring') {
93+
$needsRefresh = true;
94+
}
95+
if ($category === 'Judging') {
96+
$needsRejudging = true;
97+
}
98+
}
99+
100+
if ($needsRefresh) {
101+
$this->addFlash('scoreboard_refresh', 'After changing specific ' .
102+
'scoring related settings, you might need to refresh the scoreboard (cache).');
103+
}
104+
if ($needsRejudging) {
105+
$this->addFlash('danger', 'After changing specific ' .
106+
'judging related settings, you might need to rejudge affected submissions.');
107+
}
90108

91109
return $this->redirectToRoute('jury_config', ['diffs' => json_encode($diffs)]);
92110
} else {

webapp/src/Service/ConfigurationService.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public function get(string $name, bool $onlyIfPublic = false)
7070
return $value;
7171
}
7272

73+
public function getCategory(string $name): string
74+
{
75+
return $this->getConfigSpecification()[$name]->category;
76+
}
77+
7378
/**
7479
* Get all the configuration values, indexed by name.
7580
*

0 commit comments

Comments
 (0)