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
729
729
$ judging = null ;
730
730
$ judgingId = null ;
731
731
$ cid = null ;
732
+ $ judgingRun = null ;
732
733
if ($ judgeTaskId ) {
733
734
/** @var JudgeTask $judgeTask */
734
735
$ judgeTask = $ this ->em ->getRepository (JudgeTask::class)->findOneBy (['judgetaskid ' => $ judgeTaskId ]);
@@ -738,6 +739,7 @@ public function internalErrorAction(Request $request): ?int
738
739
$ judging = $ this ->em ->getRepository (Judging::class)->findOneBy (['judgingid ' => $ judgingId ]);
739
740
$ cid = $ judging ->getContest ()->getCid ();
740
741
}
742
+ $ judgingRun = $ this ->em ->getRepository (JudgingRun::class)->findOneBy (['judgetaskid ' => $ judgeTaskId ]);
741
743
}
742
744
743
745
$ disabled = Utils::jsonDecode ($ disabled );
@@ -796,6 +798,9 @@ public function internalErrorAction(Request $request): ?int
796
798
->setJudgehostlog ($ judgehostlog )
797
799
->setTime (Utils::now ())
798
800
->setDisabled ($ disabled );
801
+ if ($ judgingRun ) {
802
+ $ error ->setJudgingRun ($ judgingRun );
803
+ }
799
804
$ this ->em ->persist ($ error );
800
805
// Even if there are no remaining judge tasks for this judging open (which is covered by the transaction below),
801
806
// 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
69
69
#[ORM \JoinColumn(name: 'judgingid ' , referencedColumnName: 'judgingid ' , onDelete: 'SET NULL ' )]
70
70
private ?Judging $ judging = null ;
71
71
72
+ #[ORM \ManyToOne]
73
+ #[ORM \JoinColumn(name: 'runid ' , referencedColumnName: 'runid ' , onDelete: 'SET NULL ' )]
74
+ private ?JudgingRun $ judgingRun = null ;
75
+
72
76
/**
73
77
* @var Collection<int, Judging>
74
78
*/
@@ -182,4 +186,15 @@ public function getAffectedJudgings(): Collection
182
186
{
183
187
return $ this ->affectedJudgings ;
184
188
}
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
+ }
185
200
}
Original file line number Diff line number Diff line change 43
43
</td >
44
44
</tr >
45
45
{% 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 %}
46
75
{% if internalError .affectedJudgings is not null %}
47
76
<tr >
48
77
<th >Additional affected judgings</th >
You can’t perform that action at this time.
0 commit comments