diff --git a/webapp/src/Entity/Submission.php b/webapp/src/Entity/Submission.php index 74f481c4d0..66ab393d7b 100644 --- a/webapp/src/Entity/Submission.php +++ b/webapp/src/Entity/Submission.php @@ -359,6 +359,16 @@ public function getJudgings(): Collection return $this->judgings; } + public function getValidJudging(): ?Judging + { + foreach ($this->judgings as $j) { + if ($j->getValid()) { + return $j; + } + } + return null; + } + public function setLanguage(?Language $language = null): Submission { $this->language = $language; @@ -537,6 +547,16 @@ public function getExternalJudgements(): Collection return $this->external_judgements; } + public function getValidExternalJudgement(): ?ExternalJudgement + { + foreach ($this->external_judgements as $ej) { + if ($ej->getValid()) { + return $ej; + } + } + return null; + } + public function setFileForApi(?FileWithName $fileForApi = null): Submission { $this->fileForApi = $fileForApi; diff --git a/webapp/src/Service/ScoreboardService.php b/webapp/src/Service/ScoreboardService.php index 21d8b60178..db9e99ecd7 100644 --- a/webapp/src/Service/ScoreboardService.php +++ b/webapp/src/Service/ScoreboardService.php @@ -262,9 +262,9 @@ public function calculateScoreRow( foreach ($submissions as $submission) { /** @var Judging|ExternalJudgement|null $judging */ if ($useExternalJudgements) { - $judging = $submission->getExternalJudgements()->first() ?: null; + $judging = $submission->getValidExternalJudgement(); } else { - $judging = $submission->getJudgings()->first() ?: null; + $judging = $submission->getValidJudging(); } // three things will happen in the loop in this order: