Skip to content

Commit 134d5ab

Browse files
committed
Display std{out,err} output of submissions in columns using more horizontal area
Before messages would be short and on a wide monitor there would be a lot of wasted space, Now we calculate the longest line and display that in full and try to fit similar sized columns. On smaller monitors this would just result in less columns and never in a horizantal bar, if/when we want that we should set the `height`.
1 parent 0ff9413 commit 134d5ab

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

webapp/public/style_domjudge.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ a {
173173
white-space: pre;
174174
}
175175

176+
.output_text_truncate_columns {
177+
column-rule: 1px solid #c0c0c0;
178+
}
179+
176180
.clarificationform pre {
177181
border-top: 1px dotted #c0c0c0;
178182
border-bottom: 1px dotted #c0c0c0;

webapp/src/Controller/Jury/SubmissionController.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,13 @@ public function viewAction(
527527
if ($firstJudgingRun) {
528528
$runResult['testcasedir'] = $firstJudgingRun->getTestcaseDir();
529529
}
530+
foreach(['output_run', 'output_error'] as $field) {
531+
$colwidth = 0;
532+
foreach (explode("\n", $runResult[$field] ?? '') as $line) {
533+
$colwidth = max(strlen($line), $colwidth);
534+
}
535+
$runResult[$field . '_colwidth'] = $colwidth;
536+
}
530537
$runsOutput[] = $runResult;
531538
}
532539
}

webapp/templates/jury/submission.html.twig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
max-height: {{ thumbnailSize }}px;
2626
}
2727
28+
{% for runIdx in runsOutput | keys %}
29+
{% for colname in ['output_run_colwidth', 'output_error_colwidth'] %}
30+
.output_text_truncate_columns_{{ colname }}_{{ runIdx }} {
31+
column-width: {{ runsOutput[runIdx][colname] }}ch;
32+
}
33+
{% endfor %}
34+
{% endfor %}
35+
2836
.scoring-details-container .full-precision { display: none; }
2937
.scoring-details-container.show-full .rounded-precision { display: none; }
3038
.scoring-details-container.show-full .full-precision { display: inline; }
@@ -956,15 +964,15 @@
956964
{% if runsOutput[runIdx].output_run is empty %}
957965
<p class="nodata">There was no program output.</p>
958966
{% else %}
959-
<pre class="output_text">{{ runsOutput[runIdx].output_run | convertUnprintableChars }}</pre>
967+
<pre class="output_text output_text_truncate_columns output_text_truncate_columns_output_run_colwidth_{{ runIdx }}">{{ runsOutput[runIdx].output_run | convertUnprintableChars }}</pre>
960968
{% endif %}
961969
{% endif %}
962970

963971
<h5>Program error output</h5>
964972
{% if runsOutput[runIdx].output_error is empty %}
965973
<p class="nodata">There was no stderr output.</p>
966974
{% else %}
967-
<pre class="output_text">{{ runsOutput[runIdx].output_error | convertUnprintableChars }}</pre>
975+
<pre class="output_text output_text_truncate_columns output_text_truncate_columns_output_error_colwidth_{{ runIdx }}">{{ runsOutput[runIdx].output_error | convertUnprintableChars }}</pre>
968976
{% endif %}
969977

970978
<h5>Judging system output (info/debug/errors)</h5>

0 commit comments

Comments
 (0)