Skip to content

Commit b8c3596

Browse files
committed
Add clarifications to the team problemset page.
Fixes #3009
1 parent 95df1de commit b8c3596

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

webapp/src/Service/DOMJudgeService.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,7 @@ public function getTwigDataForProblemsAction(
10281028

10291029
$problems = [];
10301030
$samples = [];
1031+
$clars = [];
10311032
if ($contest && ($forJury || $contest->getFreezeData()->started())) {
10321033
$problems = $this->em->createQueryBuilder()
10331034
->from(ContestProblem::class, 'cp')
@@ -1057,6 +1058,27 @@ public function getTwigDataForProblemsAction(
10571058
foreach ($samplesData as $sample) {
10581059
$samples[$sample['probid']] = $sample['numsamples'];
10591060
}
1061+
1062+
$raw_clars = $this->em->createQueryBuilder()
1063+
->from(Clarification::class, 'clar')
1064+
->select('clar')
1065+
->andWhere('clar.contest = :cid')
1066+
// Only clars associated with a problem.
1067+
->andWhere('clar.problem IS NOT NULL')
1068+
// Only clars send from the jury.
1069+
->andWhere('clar.sender IS NULL')
1070+
// Only clars send to all teams or just this team.
1071+
->andWhere('clar.recipient IS NULL OR clar.recipient = :teamid')
1072+
->setParameter('cid', $contest->getCid())
1073+
->setParameter('teamid', $teamId)
1074+
->orderBy('clar.submittime', 'DESC')
1075+
->getQuery()
1076+
->getResult();
1077+
1078+
// Group clarifications by problem id.
1079+
foreach ($raw_clars as $clar) {
1080+
$clars[$clar->getProblem()->getProbid()][] = $clar;
1081+
}
10601082
}
10611083

10621084
$data = [
@@ -1065,6 +1087,7 @@ public function getTwigDataForProblemsAction(
10651087
'showLimits' => $showLimits,
10661088
'defaultMemoryLimit' => $defaultMemoryLimit,
10671089
'timeFactorDiffers' => $timeFactorDiffers,
1090+
'clarifications' => $clars,
10681091
];
10691092

10701093
if ($contest && $this->config->get('show_public_stats')) {

webapp/templates/partials/problem_list.html.twig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,21 @@
155155
</ol>
156156
{% endif %}
157157

158+
{% if clarifications[problem.probid] is defined and clarifications[problem.probid] %}
159+
<hr/>
160+
<h3 class="text-center">Clarifications</h3>
161+
<ol class="list-group list-group-flush">
162+
{% for clar in clarifications[problem.probid] %}
163+
<li class="list-group-item">
164+
<a data-ajax-modal data-ajax-modal-after="markSeen"
165+
href="{{ path('team_clarification', {clarId: clar.clarid}) }}">
166+
<strong>{{ clar.submittime | printtime(null, contest) }}:</strong>
167+
{{ clar.summary }}
168+
</a>
169+
</li>
170+
{% endfor %}
171+
{% endif %}
172+
158173
</div>
159174
</div>
160175
</div>

0 commit comments

Comments
 (0)