Skip to content

Commit

Permalink
Properly style judging verifier page. (DOMjudge#2100)
Browse files Browse the repository at this point in the history
  • Loading branch information
meisterT authored Jul 7, 2023
1 parent dc190a1 commit cfd7a05
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 30 deletions.
21 changes: 13 additions & 8 deletions webapp/src/Controller/Jury/JuryMiscController.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,37 +264,42 @@ public function judgingVerifierAction(Request $request): Response
/** @var string[] $expectedResults */
$expectedResults = $submission->getExpectedResults();
$submissionId = $submission->getSubmitid();
$submissionFiles = $submission->getFiles();

$result = mb_strtoupper($judging->getResult());
$entry = ['files' => $submissionFiles, 'actual' => $result, 'expected' => $expectedResults, 'contestProblem' => $submission->getContestProblem()];
if (!empty($expectedResults) && !$judging->getVerified()) {
$numChecked++;
$result = mb_strtoupper($judging->getResult());
if (!in_array($result, $expectedResults)) {
$submissionFiles = $submission->getFiles();
$unexpected[$submissionId] = ['files' => $submissionFiles, 'actual' => $result, 'expected' => $expectedResults];
$unexpected[$submissionId] = $entry;
} elseif (count($expectedResults) > 1) {
if ($verifyMultiple) {
// Judging result is as expected, set judging to verified.
$judging
->setVerified(true)
->setJuryMember($verifier);
$multiple[$submissionId] = ['actual' => $result, 'expected' => $expectedResults, 'verified' => true];
$entry['verified'] = true;
} else {
$multiple[$submissionId] = ['actual' => $result, 'expected' => $expectedResults, 'verified' => false];
$entry['verified'] = false;
}
$multiple[$submissionId] = $entry;
} else {
// Judging result is as expected, set judging to verified.
$judging
->setVerified(true)
->setJuryMember($verifier);
$verified[$submissionId] = ['actual' => $result, 'expected' => $expectedResults, 'verified' => true];
$entry['verified'] = true;
$verified[$submissionId] = $entry;
}
} else {
$numUnchecked++;

if (empty($expectedResults)) {
$nomatch[$submissionId] = [];
$entry['verified'] = false;
$nomatch[$submissionId] = $entry;
} else {
$earlier[$submissionId] = [];
$entry['verified'] = true;
$earlier[$submissionId] = $entry;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions webapp/src/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ public function displayTestcaseResults(array $testcases, bool $submissionDone, b

public function printResult(?string $result, bool $valid = true, bool $jury = false): string
{
$result = strtolower($result);
switch ($result) {
case 'too-late':
$style = 'sol_queued';
Expand Down
66 changes: 44 additions & 22 deletions webapp/templates/jury/check_judgings.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,52 @@
{% macro verifyResults(id, header, results, collapse) %}
{% if results is not empty %}
<h2><a class="collapse-link" href="javascript:collapse('#detail{{ id }}')">{{ header }}</a></h2>
<ul id="detail{{ id }}"{% if collapse | default(false) %} class="d-none"{% endif %}>
<table id="detail{{ id }}" class="{% if collapse | default(false) %}d-none{% endif %} data-table table table-hover table-striped table-sm submissions-table">
<tr>
<th></th><th>problem</th><th>file(s)</th>
<th>actual</th>
<th>expected (one of)</th>
</tr>
{% for submitId,result in results %}
<li><a href="{{ path('jury_submission', {'submitId': submitId}) }}">s{{ submitId }}</a>
{% if result.files is defined and result.files|length > 0 %}
({% for file in result.files[:3] %}
<code>{{ file.filename }}</code>
{% endfor %})
{% endif %}
{% if id == 'unexpected' %}
has unexpected result '{{ result.actual }}', should be one of: {{ result.expected|join(', ') }}
{% elseif id == 'multiple' and result.verified %}
verified as {{ result.actual }} out of multiple possible outcomes ({{ result.expected|join(', ') }})
{% elseif id == 'multiple' %}
is judged as {{ result.actual }} but has multiple possible outcomes ({{ result.expected|join(', ') }})
{% elseif id == 'verified' %}
verfied as '{{ result.actual }}'
{% elseif id == 'nomatch' %}
expected results unknown, leaving submission unchecked
{% elseif id == 'earlier' %}
already verified earlier
{% endif %}
</li>
{% set link = path('jury_submission', {'submitId': submitId}) %}
<tr>
<td><a href="{{ link }}">s{{ submitId }}</a></td>
<td>
<a href="{{ link }}">
{% if result.contestProblem is defined %}
{{ result.contestProblem | problemBadge }}
{% endif %}
</a>
</td>
<td>
<a href="{{ link }}">
{% if result.files is defined and result.files|length > 0 %}
{% for file in result.files[:3] %}
<code>{{ file.filename }}</code>
{% endfor %}
{% endif %}
</a>
</td>
<td>
<a href="{{ link }}">
{% if result is defined and result.actual is defined %}
{{ result.actual | printResult }}
{% endif %}
</a>
</td>
<td>
<a href="{{ link }}">
{% if result is defined and result.expected is defined %}
{% for r in result.expected %}
{{ r | printResult }}
{% if not loop.last %}, {% endif %}
{% endfor %}
{% endif %}
</a>
</td>
</tr>
{% endfor %}
</ul>
</table>
{% endif %}
{% endmacro %}

Expand Down

0 comments on commit cfd7a05

Please sign in to comment.