Skip to content
Merged
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
1 change: 1 addition & 0 deletions webapp/src/Controller/Jury/ShadowDifferencesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function indexAction(
->select('s', 'ej', 'j')
->andWhere('s.contest = :contest')
->andWhere('s.externalid IS NOT NULL')
->andWhere('s.expected_results IS NULL')
->setParameter('contest', $contest)
->getQuery()
->getResult();
Expand Down
9 changes: 6 additions & 3 deletions webapp/src/Service/ExternalContestSourceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException;
use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
Expand Down Expand Up @@ -107,7 +109,7 @@ public function __construct(
protected readonly EventLogService $eventLog,
protected readonly SubmissionService $submissionService,
protected readonly ScoreboardService $scoreboardService,
protected readonly SerializerInterface $serializer,
protected readonly SerializerInterface&DenormalizerInterface&NormalizerInterface $serializer,
#[Autowire('%domjudge.version%')]
string $domjudgeVersion
) {
Expand Down Expand Up @@ -1886,7 +1888,8 @@ protected function addPendingEvent(string $type, string|int $id, Event $event, C
objectId: $id,
data: [$data],
);
$dependencies[$type . '-' . $id] = ['type' => $type, 'id' => $id, 'event' => $event];
$normalizedEvent = $this->serializer->normalize($event, Event::class, ['api_version' => $this->getApiVersion()]);
$dependencies[$type . '-' . $id] = ['type' => $type, 'id' => $id, 'event' => $normalizedEvent];
$this->addOrUpdateWarning($event, $data->id, ExternalSourceWarning::TYPE_DEPENDENCY_MISSING, [
'dependencies' => $dependencies,
]);
Expand Down Expand Up @@ -1917,7 +1920,7 @@ protected function loadPendingEvents(): void

$type = $dependency['type'];
$id = $dependency['id'];
$event = $dependency['event'];
$event = $this->serializer->denormalize($dependency['event'], Event::class, 'json', ['api_version' => $this->getApiVersion()]);

if (!isset($this->pendingEvents[$type][$id])) {
$this->pendingEvents[$type][$id] = [];
Expand Down
15 changes: 13 additions & 2 deletions webapp/src/Service/SubmissionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public function getSubmissionList(
}

if ($restrictions->withExternalId ?? false) {
$queryBuilder->andWhere('s.externalid IS NOT NULL');
$queryBuilder
->andWhere('s.externalid IS NOT NULL')
->andWhere('s.expected_results IS NULL');
}

if (isset($restrictions->rejudgingId)) {
Expand Down Expand Up @@ -163,7 +165,16 @@ public function getSubmissionList(

if (isset($restrictions->externalDifference)) {
if ($restrictions->externalDifference) {
$queryBuilder->andWhere('j.result != ej.result');
if ($restrictions->result === 'judging' || $restrictions->externalResult === 'judging') {
// When either the local or external result is set to judging explicitly,
// coalesce the result with a known non-null value, because in MySQL
// 'correct' <> null is not true. By coalescing with '-' we prevent this.
$queryBuilder
->andWhere('COALESCE(j.result, :dash) != COALESCE(ej.result, :dash)')
->setParameter('dash', '-');
} else {
$queryBuilder->andWhere('j.result != ej.result');
}
} else {
$queryBuilder->andWhere('j.result = ej.result');
}
Expand Down
2 changes: 1 addition & 1 deletion webapp/templates/jury/partials/submission_graph.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
</div>
{% endif %}
{% if externalJudgement is not null and externalJudgement.result is not null %}
{% if externalJudgement is not null and externalJudgement.result is not null and externalJudging is defined %}
<div class="card" style="display: inline-block" id="externalruntime">
<div class="card-header">
<span id="graphs" style="font-weight: bold;">External Testcase CPU times
Expand Down
4 changes: 2 additions & 2 deletions webapp/templates/jury/submission.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,11 @@
{{ externalRuns | displayTestcaseResults(externalJudgement.endtime is not empty, true) }}
</td>
<td>
{% if externalSubmissionUrl and externalSubmissionUrl is not empty %}
{% if externalSubmissionUrl is defined and externalSubmissionUrl is not empty %}
<a href="{{ externalSubmissionUrl }}">
{% endif %}
external {{ externalJudgement.extjudgementid }}
{% if externalSubmissionUrl and externalSubmissionUrl is not empty %}
{% if externalSubmissionUrl is defined and externalSubmissionUrl is not empty %}
</a>
{% endif %}
</td>
Expand Down
Loading