Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions webapp/src/Service/DOMJudgeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use App\Entity\Problem;
use App\Entity\ProblemAttachment;
use App\Entity\QueueTask;
use App\Entity\ScoreCache;
use App\Entity\Rejudging;
use App\Entity\Submission;
use App\Entity\Team;
Expand Down Expand Up @@ -1039,6 +1040,7 @@
$problems = [];
$samples = [];
$clars = [];
$problemStatuses = [];
if ($contest && ($forJury || $contest->getFreezeData()->started())) {
$problems = $this->em->createQueryBuilder()
->from(ContestProblem::class, 'cp')
Expand All @@ -1053,6 +1055,26 @@
->getQuery()
->getResult();

if ($teamId) {
$scoreCache = $this->em->createQueryBuilder()
->from(ScoreCache::class, 's')
->select('s')
->andWhere('s.contest = :contest')
->andWhere('s.team = :team')
->setParameter('contest', $contest)
->setParameter('team', $this->getTeam($teamId))
->getQuery()
->getResult();

foreach ($scoreCache as $scoreRow) {
$problemStatuses[$scoreRow->getProblem()->getProbid()] = [
'is_correct' => $scoreRow->getIsCorrectRestricted(),
'submissions' => $scoreRow->getSubmissionsRestricted(),
'solvetime' => $scoreRow->getSolvetimeRestricted(),
];
}
}

$samplesData = $this->em->createQueryBuilder()
->from(ContestProblem::class, 'cp')
->join('cp.problem', 'p')
Expand Down Expand Up @@ -1099,6 +1121,7 @@
'timeFactorDiffers' => $timeFactorDiffers,
'clarifications' => $clars,
'team' => $teamId ? $this->em->getRepository(Team::class)->find($teamId) : null,
'problemStatuses' => $problemStatuses,
];

if ($contest && $this->config->get('show_public_stats')) {
Expand Down Expand Up @@ -1801,7 +1824,7 @@
}
}
}
}

Check failure on line 1827 in webapp/src/Service/DOMJudgeService.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 1 space after closing brace; newline found
elseif ($this->config->get('check_new_version', false) === UpdateStrategy::Strategy_major_release) {
/* Steer towards the latest version directly
* So the expected path would be:
Expand Down
12 changes: 11 additions & 1 deletion webapp/templates/partials/problem_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@
{% set numsamples = 0 %}
{% endif %}
<div class="card">
<div class="card-body">
<div class="card-body position-relative">
{% if problemStatuses[problem.probid] is defined %}
{% set status = problemStatuses[problem.probid] %}
<div class="position-absolute top-0 end-0 p-2">
{% if status.is_correct %}
<span class="badge text-bg-success"><i class="fas fa-check" style="font-size: 2em;"></i><br>{{ status.solvetime | scoreTime }}</span>
{% elseif status.submissions > 0 %}
<span class="badge text-bg-danger"><i class="fas fa-times" style="font-size: 2em;"></i><br>{{ status.submissions }} {% if status.submissions == 1 %}try{% else %}tries{% endif %}</span>
{% endif %}
</div>
{% endif %}
<h2 class="card-title">
{{ problem | problemBadge }}
</h2>
Expand Down
Loading