Skip to content

Commit 0cf958b

Browse files
nickygerritsenvmcj
authored andcommitted
Do not allow to delete problems from a locked contest in the UI.
Fixes #2017 (cherry picked from commit 8110fa8)
1 parent d093f90 commit 0cf958b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

webapp/src/Controller/Jury/ProblemController.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,28 @@ public function indexAction(): Response
158158
'probId' => $p->getProbid(),
159159
])
160160
];
161-
$problemactions[] = [
161+
162+
$problemIsLocked = false;
163+
foreach ($p->getContestProblems() as $contestProblem) {
164+
if ($contestProblem->getContest()->isLocked()) {
165+
$problemIsLocked = true;
166+
}
167+
}
168+
169+
$deleteAction = [
162170
'icon' => 'trash-alt',
163171
'title' => 'delete this problem',
164172
'link' => $this->generateUrl('jury_problem_delete', [
165173
'probId' => $p->getProbid(),
166174
]),
167175
'ajaxModal' => true,
168176
];
177+
if ($problemIsLocked) {
178+
$deleteAction['title'] .= ' - problem belongs to a locked contest';
179+
$deleteAction['disabled'] = true;
180+
unset($deleteAction['link']);
181+
}
182+
$problemactions[] = $deleteAction;
169183
}
170184

171185
// Add formatted {mem,output}limit row data for the table.

0 commit comments

Comments
 (0)