diff --git a/webapp/src/Controller/Jury/ContestController.php b/webapp/src/Controller/Jury/ContestController.php index 479d0d6b07..e71095d13c 100644 --- a/webapp/src/Controller/Jury/ContestController.php +++ b/webapp/src/Controller/Jury/ContestController.php @@ -258,22 +258,31 @@ public function indexAction(Request $request): Response } else { $contestactions[] = []; } - if ($this->isGranted('ROLE_ADMIN') && !$contest->isLocked()) { - $contestactions[] = [ - 'icon' => 'edit', - 'title' => 'edit this contest', - 'link' => $this->generateUrl('jury_contest_edit', [ - 'contestId' => $contest->getCid(), - ]) - ]; - $contestactions[] = [ - 'icon' => 'trash-alt', - 'title' => 'delete this contest', - 'link' => $this->generateUrl('jury_contest_delete', [ - 'contestId' => $contest->getCid(), - ]), - 'ajaxModal' => true, - ]; + if ($this->isGranted('ROLE_ADMIN')) { + if ($contest->isLocked()) { + // The number of table columns and thus the number of actions need + // to match for all rows to not get DataTables errors. + // Since we add two actions for non-locked contests, we need to add + // two empty actions for locked contests. + $contestactions[] = []; + $contestactions[] = []; + } else { + $contestactions[] = [ + 'icon' => 'edit', + 'title' => 'edit this contest', + 'link' => $this->generateUrl('jury_contest_edit', [ + 'contestId' => $contest->getCid(), + ]) + ]; + $contestactions[] = [ + 'icon' => 'trash-alt', + 'title' => 'delete this contest', + 'link' => $this->generateUrl('jury_contest_delete', [ + 'contestId' => $contest->getCid(), + ]), + 'ajaxModal' => true, + ]; + } } $contestdata['process_balloons'] = [