Skip to content

Commit

Permalink
Improve data on problems overview page.
Browse files Browse the repository at this point in the history
  • Loading branch information
meisterT committed Mar 23, 2024
1 parent a86b7b9 commit 5cf65a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions webapp/public/style_domjudge.css
Original file line number Diff line number Diff line change
Expand Up @@ -646,3 +646,7 @@ blockquote {
font-style: italic;
font-size: smaller;
}

.right {
text-align: right;
}
19 changes: 18 additions & 1 deletion webapp/src/Controller/Jury/ProblemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function indexAction(): Response
$table_fields = [
'probid' => ['title' => 'ID', 'sort' => true, 'default_sort' => true],
'name' => ['title' => 'name', 'sort' => true],
'badges' => ['title' => '', 'sort' => false],
'num_contests' => ['title' => '# contests', 'sort' => true],
'timelimit' => ['title' => 'time limit', 'sort' => true],
'memlimit' => ['title' => 'memory limit', 'sort' => true],
Expand Down Expand Up @@ -165,22 +166,38 @@ public function indexAction(): Response
}
$problemactions[] = $deleteAction;
}
$default_memlimit = $this->config->get('memory_limit');
$default_output_limit = $this->config->get('output_limit');

// Add formatted {mem,output}limit row data for the table.
foreach (['memlimit', 'outputlimit'] as $col) {
$orig_value = @$problemdata[$col]['value'];
if (!isset($orig_value)) {
$value = 'default';
if ($col == 'memlimit' && !empty($default_memlimit)) {
$value .= ' (' . Utils::printsize(1024 * $default_memlimit) . ')';
}
if ($col == 'outputlimit' && !empty($default_output_limit)) {
$value .= ' (' . Utils::printsize(1024 * $default_output_limit) . ')';
}
$problemdata[$col] = [
'value' => 'default',
'value' => $value,
'cssclass' => 'disabled',
];
} else {
$problemdata[$col] = [
'value' => Utils::printsize(1024 * $orig_value),
'sortvalue' => $orig_value,
'cssclass' => 'right',
];
}
}
$problemdata['timelimit']['value'] = @$problemdata['timelimit']['value'] . 's';
$problemdata['timelimit']['cssclass'] = 'right';

$contestProblems = $p->getContestProblems()->toArray();
$badges = array_filter($contestProblems, fn($cp) => $cp->getCid() === $this->dj->getCurrentContest()->getCid());
$problemdata['badges'] = ['value' => $badges];

// merge in the rest of the data
$problemdata = array_merge($problemdata, [
Expand Down

0 comments on commit 5cf65a4

Please sign in to comment.