Skip to content

Commit e5045a6

Browse files
Times are not strings
1 parent cdc1f55 commit e5045a6

24 files changed

+108
-111
lines changed

webapp/src/Controller/API/JudgehostController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

webapp/src/Entity/ExternalJudgement.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ExternalJudgement
6868
scale: 9,
6969
options: ['comment' => 'Time judging started', 'unsigned' => true]
7070
)]
71-
private string|float $starttime;
71+
private float $starttime;
7272

7373
#[ORM\Column(
7474
type: 'decimal',
@@ -77,7 +77,7 @@ class ExternalJudgement
7777
nullable: true,
7878
options: ['comment' => 'Time judging ended, null = still busy', 'unsigned' => true]
7979
)]
80-
private string|float|null $endtime = null;
80+
private ?float $endtime = null;
8181

8282
#[ORM\Column(
8383
options: ['comment' => 'Old external judgement is marked as invalid when receiving a new one', 'default' => 1]
@@ -163,24 +163,24 @@ public function getVerifyComment(): ?string
163163
return $this->verify_comment;
164164
}
165165

166-
public function setStarttime(string|float $starttime): ExternalJudgement
166+
public function setStarttime(float $starttime): ExternalJudgement
167167
{
168168
$this->starttime = $starttime;
169169
return $this;
170170
}
171171

172-
public function getStarttime(): string|float
172+
public function getStarttime(): float
173173
{
174174
return $this->starttime;
175175
}
176176

177-
public function setEndtime(string|float|null $endtime): ExternalJudgement
177+
public function setEndtime(?float $endtime): ExternalJudgement
178178
{
179179
$this->endtime = $endtime;
180180
return $this;
181181
}
182182

183-
public function getEndtime(): string|float|null
183+
public function getEndtime(): float|null
184184
{
185185
return $this->endtime;
186186
}

webapp/src/Entity/ExternalRun.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ExternalRun
4545
scale: 9,
4646
options: ['comment' => 'Time run ended', 'unsigned' => true]
4747
)]
48-
private string|float $endtime;
48+
private float $endtime;
4949

5050
#[ORM\Column(options: ['comment' => 'Running time on this testcase'])]
5151
private float $runtime;
@@ -89,13 +89,13 @@ public function getResult(): string
8989
return $this->result;
9090
}
9191

92-
public function setEndtime(string|float $endtime): ExternalRun
92+
public function setEndtime(float $endtime): ExternalRun
9393
{
9494
$this->endtime = $endtime;
9595
return $this;
9696
}
9797

98-
public function getEndtime(): string|float
98+
public function getEndtime(): float
9999
{
100100
return $this->endtime;
101101
}

webapp/src/Entity/ExternalSourceWarning.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ExternalSourceWarning
4040
scale: 9,
4141
options: ['comment' => 'Time this warning happened last', 'unsigned' => true]
4242
)]
43-
private string|float $lastTime;
43+
private float $lastTime;
4444

4545
#[ORM\Column(options: ['comment' => 'Type of the entity for this warning'])]
4646
private string $entityType;
@@ -81,12 +81,12 @@ public function setLastEventId(?string $lastEventId): ExternalSourceWarning
8181
return $this;
8282
}
8383

84-
public function getLastTime(): string|float
84+
public function getLastTime(): float
8585
{
8686
return $this->lastTime;
8787
}
8888

89-
public function setLastTime(string|float $lastTime): ExternalSourceWarning
89+
public function setLastTime(float $lastTime): ExternalSourceWarning
9090
{
9191
$this->lastTime = $lastTime;
9292
return $this;

0 commit comments

Comments
 (0)