Skip to content

Commit

Permalink
Use accepted and rejected instead of full verdict
Browse files Browse the repository at this point in the history
Also drop time tie breaker column.
  • Loading branch information
nickygerritsen committed Mar 1, 2025
1 parent 14242a4 commit 8c5934d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
13 changes: 12 additions & 1 deletion webapp/src/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,12 @@ public function displayTestcaseResults(array $testcases, bool $submissionDone, b
return $results;
}

public function printResult(?string $result, bool $valid = true, bool $jury = false): string
public function printResult(
?string $result,
bool $valid = true,
bool $jury = false,
bool $onlyAcceptedAndRejected = false,
): string
{

Check failure on line 522 in webapp/src/Twig/TwigExtension.php

View workflow job for this annotation

GitHub Actions / phpcs

The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
$result = strtolower($result ?? '');
switch ($result) {
Expand All @@ -536,9 +541,15 @@ public function printResult(?string $result, bool $valid = true, bool $jury = fa
break;
case 'correct':
$style = 'sol_correct';
if ($onlyAcceptedAndRejected) {
$result = 'accepted';
}
break;
default:
$style = 'sol_incorrect';
if ($onlyAcceptedAndRejected) {
$result = 'rejected';
}
}

return sprintf('<span class="sol %s">%s</span>', $valid ? $style : 'disabled', $result);
Expand Down
14 changes: 1 addition & 13 deletions webapp/templates/public/partials/submission_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
<th scope="col">time</th>
<th scope="col">language</th>
<th scope="col">result</th>
{% if contest.getRuntimeAsScoreTiebreaker() %}
<th scope="col">runtime</th>
{% endif %}
</tr>
</thead>
<tbody>
Expand All @@ -35,19 +32,10 @@
{% elseif verificationRequired and not submission.judgings.first.verified %}
{{ '' | printResult }}
{% else %}
{{ submission.judgings.first.result | printResult }}
{{ submission.judgings.first.result | printResult(true, false, true) }}
{% endif %}
{% endif %}
</td>
{% if contest.getRuntimeAsScoreTiebreaker() %}
<td>
{% if link and submission.getResult() == 'correct' %}
{{ "%0.3f s" | format(submission.judgings.first.getMaxRuntime()) }}
{% else %}
-
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
Expand Down
4 changes: 2 additions & 2 deletions webapp/templates/public/team_submissions.html.twig
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% extends "public/base.html.twig" %}

{% block title %}
{% if team is not empty %}Submissions for team {{ team.effectiveName }} and problem {{ problem.problem.name }} - {% endif %}{{ parent() }}
{% if team is not empty %}Submissions for team {{ team.effectiveName }} on problem {{ problem.problem.name }} - {% endif %}{{ parent() }}
{% endblock %}

{% block content %}
<h1 class="mt-3">
Submissions for team {{ team.effectiveName }} and problem {{ problem | problemBadge }} {{ problem.problem.name }}
Submissions for team {{ team.effectiveName }} on problem {{ problem | problemBadge }} {{ problem.problem.name }}
</h1>

{% include 'public/partials/submission_list.html.twig' %}
Expand Down
2 changes: 1 addition & 1 deletion webapp/templates/public/team_submissions_modal.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "partials/modal.html.twig" %}

{% block title %}
Submissions for team {{ team.effectiveName }} and problem {{ problem | problemBadge }} {{ problem.problem.name }}
Submissions for team {{ team.effectiveName }} on problem {{ problem | problemBadge }} {{ problem.problem.name }}
{% endblock %}

{% block content %}
Expand Down

0 comments on commit 8c5934d

Please sign in to comment.