Skip to content

Commit

Permalink
Added problem badges
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj committed Sep 21, 2023
1 parent f9ccdfd commit 296af44
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions webapp/src/Controller/Jury/ExecutableController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,25 @@ public function indexAction(Request $request): Response
'icon' => ['title' => 'type', 'sort' => false],
'execid' => ['title' => 'ID', 'sort' => true,],
'type' => ['title' => 'type', 'sort' => true,],
'badges' => ['title' => 'problems', 'sort' => false],
'description' => ['title' => 'description', 'sort' => true,],
];

$propertyAccessor = PropertyAccess::createPropertyAccessor();
$executables_table = [];
foreach ($executables as $e) {
$badges = [];
if ($this->dj->getCurrentContest()) {
foreach([$e->getProblemsCompare(), $e->getProblemsRun()] as $problemList) {

Check failure on line 71 in webapp/src/Controller/Jury/ExecutableController.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 1 space(s) after FOREACH keyword; 0 found
foreach ($problemList as $p) {
foreach ($this->dj->getCurrentContest()->getProblems() as $cp) {
if ($cp->getProblem() === $p) {
$badges[] = $cp;
}
}
}
}
}
$execdata = [];
$execactions = [];
// Get whatever fields we can from the team object itself.
Expand All @@ -91,6 +104,7 @@ public function indexAction(Request $request): Response
default:
$execdata['icon']['icon'] = 'question';
}
$execdata['badges']['value'] = $badges;

if ($this->isGranted('ROLE_ADMIN')) {
$execactions[] = [
Expand Down
4 changes: 4 additions & 0 deletions webapp/templates/jury/jury_macros.twig
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@
{{- (item.value|default(item.default|default('')))|affiliationLogo(item.title) -}}
{% elseif key == "warning_content" %}
{{- item.value|printWarningContent -}}
{% elseif key == "badges" %}
{% for badge in item.value %}
{{- badge|problemBadge -}}
{% endfor %}
{% elseif (column.render | default('')) == "entity_id_badge" %}
{% if item.value %}{{- item.value|entityIdBadge(item.idPrefix|default('')) -}}{% endif %}
{% else %}
Expand Down

0 comments on commit 296af44

Please sign in to comment.