Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 761f323

Browse files
Sync database schema with entities
1 parent eedd68a commit 761f323

27 files changed

+154
-115
lines changed

‎webapp/migrations/Version20250309122806.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace DoctrineMigrations;
66

7+
use App\Entity\RankCache;
78
use Doctrine\DBAL\Schema\Schema;
89
use Doctrine\Migrations\AbstractMigration;
910

@@ -21,8 +22,8 @@ public function up(Schema $schema): void
2122
{
2223
// this up() migration is auto-generated, please modify it to your needs
2324
$this->addSql('ALTER TABLE rankcache ADD sort_key_public TEXT DEFAULT \'\' NOT NULL COMMENT \'Opaque sort key for public audience.\', ADD sort_key_restricted TEXT DEFAULT \'\' NOT NULL COMMENT \'Opaque sort key for restricted audience.\'');
24-
$this->addSql('CREATE INDEX sortKeyPublic ON rankcache (sort_key_public)');
25-
$this->addSql('CREATE INDEX sortKeyRestricted ON rankcache (sort_key_restricted)');
25+
$this->addSql(sprintf('CREATE INDEX sortKeyPublic ON rankcache (sort_key_public(%s))', RankCache::SORT_KEY_INDEX_SIZE));
26+
$this->addSql(sprintf('CREATE INDEX sortKeyRestricted ON rankcache (sort_key_restricted(%s))', RankCache::SORT_KEY_INDEX_SIZE));
2627
}
2728

2829
public function down(Schema $schema): void

‎webapp/migrations/Version20250323190305.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class Version20250323190305 extends AbstractMigration
1414
{
1515
public function getDescription(): string
1616
{
17-
return '';
17+
return 'Add problem types';
1818
}
1919

2020
public function up(Schema $schema): void
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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 Version20250620082406 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return 'Change comments to reflect entities';
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 judging CHANGE max_runtime_for_verdict max_runtime_for_verdict NUMERIC(32, 9) UNSIGNED DEFAULT NULL COMMENT \'The maximum runtime for all runs that resulted in the verdict\'');
24+
$this->addSql('ALTER TABLE problem CHANGE types types INT NOT NULL COMMENT \'Bitmask of problem types, default is pass-fail.\'');
25+
}
26+
27+
public function down(Schema $schema): void
28+
{
29+
// this down() migration is auto-generated, please modify it to your needs
30+
$this->addSql('ALTER TABLE problem CHANGE types types INT NOT NULL COMMENT \'Bitset of problem types, default is pass-fail.\'');
31+
$this->addSql('ALTER TABLE judging CHANGE max_runtime_for_verdict max_runtime_for_verdict NUMERIC(32, 9) UNSIGNED DEFAULT NULL COMMENT \'The maximum run time for all runs that resulted in the verdict\'');
32+
}
33+
34+
public function isTransactional(): bool
35+
{
36+
return false;
37+
}
38+
}

‎webapp/src/Controller/API/JudgehostController.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,8 @@ public function addJudgingRunAction(
644644
}
645645

646646
$runResult = $request->request->get('runresult');
647-
$startTime = $request->request->get('start_time');
648-
$endTime = $request->request->get('end_time');
647+
$startTime = (float)$request->request->get('start_time');
648+
$endTime = (float)$request->request->get('end_time');
649649
$runTime = $request->request->get('runtime');
650650
$outputRun = $request->request->get('output_run');
651651
$outputDiff = $request->request->get('output_diff');
@@ -926,8 +926,8 @@ private function addSingleJudgingRun(
926926
string $hostname,
927927
string $runResult,
928928
string $runTime,
929-
string $startTime,
930-
string $endTime,
929+
float $startTime,
930+
float $endTime,
931931
string $outputSystem,
932932
string $outputError,
933933
string $outputDiff,

‎webapp/src/DataFixtures/Test/SampleSubmissionsInBucketsFixture.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function load(ObjectManager $manager): void
2121
->setStarttimeString('2022年01月01日 00:00:00 Europe/Amsterdam')
2222
->setFreezetimeString('2022年01月01日 04:05:00 Europe/Amsterdam')
2323
->setEndtimeString('2022年01月01日 05:00:00 Europe/Amsterdam')
24-
->setUnfreezetime(sprintf('%d-01-01 05:00:00 Europe/Amsterdam', date('Y') + 1));
24+
->setUnfreezetimeString(sprintf('%d-01-01 05:00:00 Europe/Amsterdam', (int)date('Y') + 1));
2525
$manager->flush();
2626

2727
// Now add some submissions:

‎webapp/src/Entity/AuditLog.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AuditLog
2929
scale: 9,
3030
options: ['comment' => 'Timestamp of the logentry', 'unsigned' => true]
3131
)]
32-
private string|float $logtime;
32+
private float $logtime;
3333

3434
#[ORM\Column(
3535
nullable: true,
@@ -70,13 +70,13 @@ public function getLogid(): ?int
7070
return $this->logid;
7171
}
7272

73-
public function setLogtime(string|float $logtime): AuditLog
73+
public function setLogtime(float $logtime): AuditLog
7474
{
7575
$this->logtime = $logtime;
7676
return $this;
7777
}
7878

79-
public function getLogtime(): string|float
79+
public function getLogtime(): float
8080
{
8181
return $this->logtime;
8282
}

‎webapp/src/Entity/Clarification.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Clarification extends BaseApiEntity implements
6161
options: ['comment' => 'Time sent', 'unsigned' => true]
6262
)]
6363
#[Serializer\Exclude]
64-
private string|float $submittime;
64+
private float $submittime;
6565

6666
#[ORM\Column(nullable: true, options: ['comment' => 'Name of jury member who answered this'])]
6767
#[Serializer\Exclude]
@@ -145,13 +145,13 @@ public function getExternalid(): ?string
145145
return $this->externalid;
146146
}
147147

148-
public function setSubmittime(string|float $submittime): Clarification
148+
public function setSubmittime(float $submittime): Clarification
149149
{
150150
$this->submittime = $submittime;
151151
return $this;
152152
}
153153

154-
public function getSubmittime(): string|float
154+
public function getSubmittime(): float
155155
{
156156
return $this->submittime;
157157
}

‎webapp/src/Entity/Contest.php‎

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Contest extends BaseApiEntity implements
8383
options: ['comment' => 'Time contest becomes visible in team/public views', 'unsigned' => true]
8484
)]
8585
#[Serializer\Exclude]
86-
private string|float|null $activatetime;
86+
private ?float $activatetime;
8787

8888
#[ORM\Column(
8989
type: 'decimal',
@@ -92,7 +92,7 @@ class Contest extends BaseApiEntity implements
9292
options: ['comment' => 'Time contest starts, submissions accepted', 'unsigned' => true]
9393
)]
9494
#[Serializer\Exclude]
95-
private string|float|null $starttime = null;
95+
private ?float $starttime = null;
9696

9797
#[ORM\Column(options: [
9898
'comment' => 'If disabled, starttime is not used, e.g. to delay contest start',
@@ -109,7 +109,7 @@ class Contest extends BaseApiEntity implements
109109
options: ['comment' => 'Time scoreboard is frozen', 'unsigned' => true]
110110
)]
111111
#[Serializer\Exclude]
112-
private string|float|null $freezetime = null;
112+
private ?float $freezetime = null;
113113

114114
#[ORM\Column(
115115
type: 'decimal',
@@ -118,7 +118,7 @@ class Contest extends BaseApiEntity implements
118118
options: ['comment' => 'Time after which no more submissions are accepted', 'unsigned' => true]
119119
)]
120120
#[Serializer\Exclude]
121-
private string|float|null $endtime;
121+
private ?float $endtime;
122122

123123
#[ORM\Column(
124124
type: 'decimal',
@@ -128,7 +128,7 @@ class Contest extends BaseApiEntity implements
128128
options: ['comment' => 'Unfreeze a frozen scoreboard at this time', 'unsigned' => true]
129129
)]
130130
#[Serializer\Exclude]
131-
private string|float|null $unfreezetime = null;
131+
private ?float $unfreezetime = null;
132132

133133
#[ORM\Column(
134134
type: 'decimal',
@@ -138,7 +138,7 @@ class Contest extends BaseApiEntity implements
138138
options: ['comment' => 'Time when contest was finalized, null if not yet', 'unsigned' => true]
139139
)]
140140
#[Serializer\Exclude]
141-
private string|float|null $finalizetime = null;
141+
private ?float $finalizetime = null;
142142

143143
#[ORM\Column(
144144
type: 'text',
@@ -213,7 +213,7 @@ public function getScoreboardTypeString(): string
213213
options: ['comment' => 'Time contest becomes invisible in team/public views', 'unsigned' => true]
214214
)]
215215
#[Serializer\Exclude]
216-
private string|float|null $deactivatetime = null;
216+
private ?float $deactivatetime = null;
217217

218218
#[ORM\Column(
219219
length: 64,
@@ -513,7 +513,7 @@ public function getActivatetime(): ?float
513513
return $this->activatetime === null ? null : (float)$this->activatetime;
514514
}
515515

516-
public function setStarttime(string|float $starttime): Contest
516+
public function setStarttime(float $starttime): Contest
517517
{
518518
$this->starttime = $starttime;
519519
return $this;
@@ -581,7 +581,7 @@ public function getFinalizetime(): ?float
581581
return $this->finalizetime === null ? null : (float)$this->finalizetime;
582582
}
583583

584-
public function setFinalizetime(string|float|null $finalizetimeString): Contest
584+
public function setFinalizetime(?float $finalizetimeString): Contest
585585
{
586586
$this->finalizetime = $finalizetimeString;
587587
return $this;
@@ -699,34 +699,31 @@ public function getDeactivatetimeString(): ?string
699699
return $this->deactivatetimeString;
700700
}
701701

702-
public function setActivatetime(string $activatetime): Contest
702+
public function setActivatetime(float $activatetime): Contest
703703
{
704704
$this->activatetime = $activatetime;
705705
return $this;
706706
}
707707

708-
public function setFreezetime(string $freezetime): Contest
708+
public function setFreezetime(float $freezetime): Contest
709709
{
710710
$this->freezetime = $freezetime;
711711
return $this;
712712
}
713713

714-
public function setEndtime(string $endtime): Contest
714+
public function setEndtime(float $endtime): Contest
715715
{
716716
$this->endtime = $endtime;
717717
return $this;
718718
}
719719

720-
/**
721-
* @param string|float $unfreezetime
722-
*/
723-
public function setUnfreezetime($unfreezetime): Contest
720+
public function setUnfreezetime(float $unfreezetime): Contest
724721
{
725722
$this->unfreezetime = $unfreezetime;
726723
return $this;
727724
}
728725

729-
public function setDeactivatetime(string $deactivatetime): Contest
726+
public function setDeactivatetime(float $deactivatetime): Contest
730727
{
731728
$this->deactivatetime = $deactivatetime;
732729
return $this;
@@ -1045,7 +1042,7 @@ public function isActive(): bool
10451042
($this->deactivatetime == null || $this->deactivatetime > time());
10461043
}
10471044

1048-
public function getAbsoluteTime(?string $time_string): float|int|string|null
1045+
public function getAbsoluteTime(?string $time_string): float|int|null
10491046
{
10501047
if ($time_string === null) {
10511048
return null;
@@ -1076,7 +1073,7 @@ public function getAbsoluteTime(?string $time_string): float|int|string|null
10761073
} catch (Exception) {
10771074
return null;
10781075
}
1079-
return $date->format('U.v');
1076+
return (float)$date->format('U.v');
10801077
}
10811078
}
10821079

‎webapp/src/Entity/Event.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Event
2929
scale: 9,
3030
options: ['comment' => 'When the event occurred', 'unsigned' => true]
3131
)]
32-
private string|float $eventtime;
32+
private float $eventtime;
3333

3434
#[ORM\Column(length: 32, options: ['comment' => 'API endpoint associated to this entry'])]
3535
private string $endpointtype;
@@ -64,13 +64,13 @@ public function getEventid(): int
6464
return $this->eventid;
6565
}
6666

67-
public function setEventtime(string|float $eventtime): Event
67+
public function setEventtime(float $eventtime): Event
6868
{
6969
$this->eventtime = $eventtime;
7070
return $this;
7171
}
7272

73-
public function getEventtime(): string|float
73+
public function getEventtime(): float
7474
{
7575
return $this->eventtime;
7676
}

‎webapp/src/Entity/ExternalContestSource.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ExternalContestSource
4747
nullable: true,
4848
options: ['comment' => 'Time of last poll by event feed reader', 'unsigned' => true]
4949
)]
50-
private string|float|null $lastPollTime = null;
50+
private ?float $lastPollTime = null;
5151

5252
#[ORM\Column(
5353
type: 'smallint',
@@ -139,12 +139,12 @@ public function setLastEventId(?string $lastEventId): ExternalContestSource
139139
return $this;
140140
}
141141

142-
public function getLastPollTime(): string|float|null
142+
public function getLastPollTime(): float|null
143143
{
144144
return $this->lastPollTime;
145145
}
146146

147-
public function setLastPollTime(string|float|null $lastPollTime): ExternalContestSource
147+
public function setLastPollTime(?float $lastPollTime): ExternalContestSource
148148
{
149149
$this->lastPollTime = $lastPollTime;
150150
return $this;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /