File tree Expand file tree Collapse file tree 4 files changed +89
-0
lines changed Expand file tree Collapse file tree 4 files changed +89
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace DoctrineMigrations ;
6+
7+ use Doctrine \DBAL \Schema \Schema ;
8+ use Doctrine \Migrations \AbstractMigration ;
9+
10+ /**
11+ * Auto-generated Migration: Please modify to your needs!
12+ */
13+ final class Version20250302114442 extends AbstractMigration
14+ {
15+ public function getDescription (): string
16+ {
17+ return 'Associate internal errors with judging run if possible. ' ;
18+ }
19+
20+ public function up (Schema $ schema ): void
21+ {
22+ // this up() migration is auto-generated, please modify it to your needs
23+ $ this ->addSql ('ALTER TABLE internal_error ADD runid INT UNSIGNED DEFAULT NULL COMMENT \'Run ID \'' );
24+ $ this ->addSql ('ALTER TABLE internal_error ADD CONSTRAINT FK_518727D8A5788799 FOREIGN KEY (runid) REFERENCES judging_run (runid) ON DELETE SET NULL ' );
25+ $ this ->addSql ('CREATE INDEX IDX_518727D8A5788799 ON internal_error (runid) ' );
26+ }
27+
28+ public function down (Schema $ schema ): void
29+ {
30+ // this down() migration is auto-generated, please modify it to your needs
31+ $ this ->addSql ('ALTER TABLE internal_error DROP FOREIGN KEY FK_518727D8A5788799 ' );
32+ $ this ->addSql ('DROP INDEX IDX_518727D8A5788799 ON internal_error ' );
33+ $ this ->addSql ('ALTER TABLE internal_error DROP runid ' );
34+ }
35+
36+ public function isTransactional (): bool
37+ {
38+ return false ;
39+ }
40+ }
Original file line number Diff line number Diff line change @@ -729,6 +729,7 @@ public function internalErrorAction(Request $request): ?int
729729 $ judging = null ;
730730 $ judgingId = null ;
731731 $ cid = null ;
732+ $ judgingRun = null ;
732733 if ($ judgeTaskId ) {
733734 /** @var JudgeTask $judgeTask */
734735 $ judgeTask = $ this ->em ->getRepository (JudgeTask::class)->findOneBy (['judgetaskid ' => $ judgeTaskId ]);
@@ -738,6 +739,7 @@ public function internalErrorAction(Request $request): ?int
738739 $ judging = $ this ->em ->getRepository (Judging::class)->findOneBy (['judgingid ' => $ judgingId ]);
739740 $ cid = $ judging ->getContest ()->getCid ();
740741 }
742+ $ judgingRun = $ this ->em ->getRepository (JudgingRun::class)->findOneBy (['judgetaskid ' => $ judgeTaskId ]);
741743 }
742744
743745 $ disabled = Utils::jsonDecode ($ disabled );
@@ -796,6 +798,9 @@ public function internalErrorAction(Request $request): ?int
796798 ->setJudgehostlog ($ judgehostlog )
797799 ->setTime (Utils::now ())
798800 ->setDisabled ($ disabled );
801+ if ($ judgingRun ) {
802+ $ error ->setJudgingRun ($ judgingRun );
803+ }
799804 $ this ->em ->persist ($ error );
800805 // Even if there are no remaining judge tasks for this judging open (which is covered by the transaction below),
801806 // we need to mark this judging as internal error.
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ class InternalError
6969 #[ORM \JoinColumn(name: 'judgingid ' , referencedColumnName: 'judgingid ' , onDelete: 'SET NULL ' )]
7070 private ?Judging $ judging = null ;
7171
72+ #[ORM \ManyToOne]
73+ #[ORM \JoinColumn(name: 'runid ' , referencedColumnName: 'runid ' , onDelete: 'SET NULL ' )]
74+ private ?JudgingRun $ judgingRun = null ;
75+
7276 /**
7377 * @var Collection<int, Judging>
7478 */
@@ -182,4 +186,15 @@ public function getAffectedJudgings(): Collection
182186 {
183187 return $ this ->affectedJudgings ;
184188 }
189+
190+ public function getJudgingRun (): ?JudgingRun
191+ {
192+ return $ this ->judgingRun ;
193+ }
194+
195+ public function setJudgingRun (?JudgingRun $ judgingRun = null ): InternalError
196+ {
197+ $ this ->judgingRun = $ judgingRun ;
198+ return $ this ;
199+ }
185200}
Original file line number Diff line number Diff line change 4343 </td >
4444 </tr >
4545 {% endif %}
46+ {% if internalError .judgingRun is not null %}
47+ <tr >
48+ <th >Related judging run / testcase</th >
49+ <td >
50+ {% set tc = internalError .judgingRun .testcase %}
51+ <ul >
52+ <li >
53+ <a href =" {{ path(' jury_submission_by_judging' , {jid : internalError .judging .judgingid }) }}#run-{{ tc .rank }}" >
54+ tc{{ tc .testcaseid }}
55+ </a >
56+ </li >
57+ <li >
58+ rank: {{ tc .rank }}
59+ </li >
60+ {% if tc .description is not empty %}
61+ <li >
62+ description: {{ tc .description }}
63+ </li >
64+ {% endif %}
65+ <li >
66+ original filename: <code >{{ tc .origInputFilename }}.in</code >
67+ </li >
68+ <li >
69+ testcase group: {{ (tc .sample ) ? ' sample' : ' secret' }}
70+ </li >
71+ </ul >
72+ </td >
73+ </tr >
74+ {% endif %}
4675 {% if internalError .affectedJudgings is not null %}
4776 <tr >
4877 <th >Additional affected judgings</th >
You can’t perform that action at this time.
0 commit comments