From 206674f83bd59b408200b083210d7752eff4a0f6 Mon Sep 17 00:00:00 2001 From: Jaap Eldering Date: Sat, 25 Nov 2023 15:39:02 +0100 Subject: [PATCH] Use printMetadata also for judging metadata Also fix some small inconsistencies and typo's: - rename title text 'runtime' to 'exit-status' - replace non-existing icon fa-exitcode - tiny tweaks to add missing spaces in output --- .../Controller/Jury/SubmissionController.php | 9 +------ webapp/src/Twig/TwigExtension.php | 18 ++++++------- webapp/templates/jury/submission.html.twig | 26 ++++++------------- 3 files changed, 17 insertions(+), 36 deletions(-) diff --git a/webapp/src/Controller/Jury/SubmissionController.php b/webapp/src/Controller/Jury/SubmissionController.php index 0fe350d894..fb85d2f937 100644 --- a/webapp/src/Controller/Jury/SubmissionController.php +++ b/webapp/src/Controller/Jury/SubmissionController.php @@ -377,15 +377,8 @@ public function viewAction( } $runs[] = $runResult[0]; unset($runResult[0]); - if (empty($runResult['metadata'])) { - $runResult['cpu_time'] = $firstJudgingRun === null ? 'n/a' : $firstJudgingRun->getRuntime(); - } else { + if (!empty($runResult['metadata'])) { $metadata = $this->dj->parseMetadata($runResult['metadata']); - $runResult['cpu_time'] = $metadata['cpu-time']; - $runResult['wall_time'] = $metadata['wall-time']; - $runResult['memory'] = Utils::printsize((int)$metadata['memory-bytes'], 2); - $runResult['exitcode'] = $metadata['exitcode']; - $runResult['signal'] = $metadata['signal'] ?? -1; $runResult['output_limit'] = $metadata['output-truncated']; } $runResult['terminated'] = preg_match('/timelimit exceeded.*hard (wall|cpu) time/', diff --git a/webapp/src/Twig/TwigExtension.php b/webapp/src/Twig/TwigExtension.php index 7b6189ed66..f6a4d68af6 100644 --- a/webapp/src/Twig/TwigExtension.php +++ b/webapp/src/Twig/TwigExtension.php @@ -1066,16 +1066,14 @@ public function printMetadata(?string $metadata): string } $metadata = $this->dj->parseMetadata($metadata); return '' - . '' - . $metadata['cpu-time'] . 's' - . ' CPU, ' - . $metadata['wall-time'] . 's' - . ' wall time, ' - . '' - . Utils::printsize((int)($metadata['memory-bytes'])) - . ', ' - . '' - . 'exit-code: ' . $metadata['exitcode']; + . ' ' + . $metadata['cpu-time'] . 's CPU, ' + . $metadata['wall-time'] . 's wall, ' + . ' ' + . Utils::printsize((int)($metadata['memory-bytes'])) . ', ' + . ' ' + . 'exit-code: ' . $metadata['exitcode'] + . (($metadata['signal'] ?? -1) > 0 ? ' signal: ' . $metadata['signal'] : ''); } public function printWarningContent(ExternalSourceWarning $warning): string diff --git a/webapp/templates/jury/submission.html.twig b/webapp/templates/jury/submission.html.twig index 4559184bd0..d25a617347 100644 --- a/webapp/templates/jury/submission.html.twig +++ b/webapp/templates/jury/submission.html.twig @@ -712,24 +712,14 @@
- {% if run.firstJudgingRun is not null and runsOutput[runIdx].cpu_time %} - - - {{ runsOutput[runIdx].cpu_time }}s - CPU{% if runsOutput[runIdx].metadata is not null %}, - {{ runsOutput[runIdx].wall_time }}s wall, - - {{ runsOutput[runIdx].memory }}, - - exit code: - {{ runsOutput[runIdx].exitcode }}{% if runsOutput[runIdx].signal > 0 %}, - signal: {{ runsOutput[runIdx].signal }} - {% endif %} - + {% if run.firstJudgingRun is not null %} + {{ runsOutput[runIdx].metadata | printMetadata }} + + {% if runsOutput[runIdx].metadata is not null %} {% if runsOutput[runIdx].output_limit %}
The submission output ({{ runsOutput[runIdx].output_limit }}) was