Skip to content

Commit be09ca3

Browse files
In shadow differences, when explicitly selecting judging for local or external results, show differences correctly
1 parent eec35e7 commit be09ca3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

webapp/src/Service/SubmissionService.php

Lines changed: 15 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)) {
@@ -145,6 +147,8 @@ public function getSubmissionList(
145147
}
146148
}
147149

150+
dump($restrictions);
151+
148152
if (isset($restrictions->externallyJudged)) {
149153
if ($restrictions->externallyJudged) {
150154
$queryBuilder->andWhere('ej.result IS NOT NULL');
@@ -163,7 +167,16 @@ public function getSubmissionList(
163167

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

0 commit comments

Comments
 (0)