Skip to content

Commit 5de560c

Browse files
In shadow differences, when explicitly selecting judging for local or external results, show differences correctly
1 parent 049c44f commit 5de560c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

webapp/src/Service/SubmissionService.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ public function getSubmissionList(
8989
}
9090

9191
if ($restrictions->withExternalId ?? false) {
92-
$queryBuilder->andWhere('s.externalid IS NOT NULL');
92+
$queryBuilder
93+
->andWhere('s.externalid IS NOT NULL')
94+
->andWhere('s.expected_results IS NULL');
9395
}
9496

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

164166
if (isset($restrictions->externalDifference)) {
165167
if ($restrictions->externalDifference) {
166-
$queryBuilder->andWhere('j.result != ej.result');
168+
if ($restrictions->result === 'judging' || $restrictions->externalResult === 'judging') {
169+
// When either the local or external result is set to judging explicitly,
170+
// coalesce the result with a known non-null value, because in MySQL
171+
// 'correct' <> null is not true. By coalescing with '-' we prevent this.
172+
$queryBuilder
173+
->andWhere('COALESCE(j.result, :dash) != COALESCE(ej.result, :dash)')
174+
->setParameter('dash', '-');
175+
} else {
176+
$queryBuilder->andWhere('j.result != ej.result');
177+
}
167178
} else {
168179
$queryBuilder->andWhere('j.result = ej.result');
169180
}

0 commit comments

Comments
 (0)