|
11 | 11 | use App\Entity\Judging;
|
12 | 12 | use App\Entity\JudgingRun;
|
13 | 13 | use App\Entity\Language;
|
| 14 | +use App\Entity\Problem; |
14 | 15 | use App\Entity\Submission;
|
15 | 16 | use App\Entity\SubmissionFile;
|
16 | 17 | use App\Entity\TeamCategory;
|
@@ -107,6 +108,7 @@ public function getFilters(): array
|
107 | 108 | new TwigFilter('tsvField', $this->toTsvField(...)),
|
108 | 109 | new TwigFilter('fileTypeIcon', $this->fileTypeIcon(...)),
|
109 | 110 | new TwigFilter('problemBadge', $this->problemBadge(...), ['is_safe' => ['html']]),
|
| 111 | + new TwigFilter('problemBadgeForProblemAndContest', $this->problemBadgeForProblemAndContest(...), ['is_safe' => ['html']]), |
110 | 112 | new TwigFilter('printMetadata', $this->printMetadata(...), ['is_safe' => ['html']]),
|
111 | 113 | new TwigFilter('printWarningContent', $this->printWarningContent(...), ['is_safe' => ['html']]),
|
112 | 114 | new TwigFilter('entityIdBadge', $this->entityIdBadge(...), ['is_safe' => ['html']]),
|
@@ -1079,6 +1081,16 @@ public function problemBadge(ContestProblem $problem): string
|
1079 | 1081 | );
|
1080 | 1082 | }
|
1081 | 1083 |
|
| 1084 | + public function problemBadgeForProblemAndContest(Problem $problem, Contest $contest): string |
| 1085 | + { |
| 1086 | + foreach ($problem->getContestProblems() as $contestProblem) { |
| 1087 | + if ($contestProblem->getContest() === $contest) { |
| 1088 | + return $this->problemBadge($contestProblem); |
| 1089 | + } |
| 1090 | + } |
| 1091 | + return ''; |
| 1092 | + } |
| 1093 | + |
1082 | 1094 | public function printMetadata(?string $metadata): string
|
1083 | 1095 | {
|
1084 | 1096 | if ($metadata === null) {
|
|
0 commit comments