diff --git a/webapp/migrations/Version20250309122806.php b/webapp/migrations/Version20250309122806.php index d61567510e..6f4f52f5cb 100644 --- a/webapp/migrations/Version20250309122806.php +++ b/webapp/migrations/Version20250309122806.php @@ -4,6 +4,7 @@ namespace DoctrineMigrations; +use App\Entity\RankCache; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -21,8 +22,8 @@ public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $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.\''); - $this->addSql('CREATE INDEX sortKeyPublic ON rankcache (sort_key_public)'); - $this->addSql('CREATE INDEX sortKeyRestricted ON rankcache (sort_key_restricted)'); + $this->addSql(sprintf('CREATE INDEX sortKeyPublic ON rankcache (sort_key_public(%s))', RankCache::SORT_KEY_INDEX_SIZE)); + $this->addSql(sprintf('CREATE INDEX sortKeyRestricted ON rankcache (sort_key_restricted(%s))', RankCache::SORT_KEY_INDEX_SIZE)); } public function down(Schema $schema): void diff --git a/webapp/migrations/Version20250323190305.php b/webapp/migrations/Version20250323190305.php index 126980b53d..edab8b5662 100644 --- a/webapp/migrations/Version20250323190305.php +++ b/webapp/migrations/Version20250323190305.php @@ -14,7 +14,7 @@ final class Version20250323190305 extends AbstractMigration { public function getDescription(): string { - return ''; + return 'Add problem types'; } public function up(Schema $schema): void diff --git a/webapp/migrations/Version20250620082406.php b/webapp/migrations/Version20250620082406.php new file mode 100644 index 0000000000..07c52b9347 --- /dev/null +++ b/webapp/migrations/Version20250620082406.php @@ -0,0 +1,38 @@ +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\''); + $this->addSql('ALTER TABLE problem CHANGE types types INT NOT NULL COMMENT \'Bitmask of problem types, default is pass-fail.\''); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE problem CHANGE types types INT NOT NULL COMMENT \'Bitset of problem types, default is pass-fail.\''); + $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\''); + } + + public function isTransactional(): bool + { + return false; + } +} diff --git a/webapp/src/Controller/API/JudgehostController.php b/webapp/src/Controller/API/JudgehostController.php index e9b184606f..00e4ea7b41 100644 --- a/webapp/src/Controller/API/JudgehostController.php +++ b/webapp/src/Controller/API/JudgehostController.php @@ -644,8 +644,8 @@ public function addJudgingRunAction( } $runResult = $request->request->get('runresult'); - $startTime = $request->request->get('start_time'); - $endTime = $request->request->get('end_time'); + $startTime = (float)$request->request->get('start_time'); + $endTime = (float)$request->request->get('end_time'); $runTime = $request->request->get('runtime'); $outputRun = $request->request->get('output_run'); $outputDiff = $request->request->get('output_diff'); @@ -926,8 +926,8 @@ private function addSingleJudgingRun( string $hostname, string $runResult, string $runTime, - string $startTime, - string $endTime, + float $startTime, + float $endTime, string $outputSystem, string $outputError, string $outputDiff, diff --git a/webapp/src/DataFixtures/Test/SampleSubmissionsInBucketsFixture.php b/webapp/src/DataFixtures/Test/SampleSubmissionsInBucketsFixture.php index a3304b4ead..54314f8dad 100644 --- a/webapp/src/DataFixtures/Test/SampleSubmissionsInBucketsFixture.php +++ b/webapp/src/DataFixtures/Test/SampleSubmissionsInBucketsFixture.php @@ -21,7 +21,7 @@ public function load(ObjectManager $manager): void ->setStarttimeString('2022-01-01 00:00:00 Europe/Amsterdam') ->setFreezetimeString('2022-01-01 04:05:00 Europe/Amsterdam') ->setEndtimeString('2022-01-01 05:00:00 Europe/Amsterdam') - ->setUnfreezetime(sprintf('%d-01-01 05:00:00 Europe/Amsterdam', date('Y') + 1)); + ->setUnfreezetimeString(sprintf('%d-01-01 05:00:00 Europe/Amsterdam', (int)date('Y') + 1)); $manager->flush(); // Now add some submissions: diff --git a/webapp/src/Entity/AuditLog.php b/webapp/src/Entity/AuditLog.php index 416620d9bf..3c945ada36 100644 --- a/webapp/src/Entity/AuditLog.php +++ b/webapp/src/Entity/AuditLog.php @@ -29,7 +29,7 @@ class AuditLog scale: 9, options: ['comment' => 'Timestamp of the logentry', 'unsigned' => true] )] - private string|float $logtime; + private float $logtime; #[ORM\Column( nullable: true, @@ -70,13 +70,13 @@ public function getLogid(): ?int return $this->logid; } - public function setLogtime(string|float $logtime): AuditLog + public function setLogtime(float $logtime): AuditLog { $this->logtime = $logtime; return $this; } - public function getLogtime(): string|float + public function getLogtime(): float { return $this->logtime; } diff --git a/webapp/src/Entity/Clarification.php b/webapp/src/Entity/Clarification.php index e848bde630..9933cb96e3 100644 --- a/webapp/src/Entity/Clarification.php +++ b/webapp/src/Entity/Clarification.php @@ -61,7 +61,7 @@ class Clarification extends BaseApiEntity implements options: ['comment' => 'Time sent', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float $submittime; + private float $submittime; #[ORM\Column(nullable: true, options: ['comment' => 'Name of jury member who answered this'])] #[Serializer\Exclude] @@ -145,13 +145,13 @@ public function getExternalid(): ?string return $this->externalid; } - public function setSubmittime(string|float $submittime): Clarification + public function setSubmittime(float $submittime): Clarification { $this->submittime = $submittime; return $this; } - public function getSubmittime(): string|float + public function getSubmittime(): float { return $this->submittime; } diff --git a/webapp/src/Entity/Contest.php b/webapp/src/Entity/Contest.php index 5d5d0b3ca3..59deca2085 100644 --- a/webapp/src/Entity/Contest.php +++ b/webapp/src/Entity/Contest.php @@ -83,7 +83,7 @@ class Contest extends BaseApiEntity implements options: ['comment' => 'Time contest becomes visible in team/public views', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $activatetime; + private ?float $activatetime; #[ORM\Column( type: 'decimal', @@ -92,7 +92,7 @@ class Contest extends BaseApiEntity implements options: ['comment' => 'Time contest starts, submissions accepted', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $starttime = null; + private ?float $starttime = null; #[ORM\Column(options: [ 'comment' => 'If disabled, starttime is not used, e.g. to delay contest start', @@ -109,7 +109,7 @@ class Contest extends BaseApiEntity implements options: ['comment' => 'Time scoreboard is frozen', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $freezetime = null; + private ?float $freezetime = null; #[ORM\Column( type: 'decimal', @@ -118,7 +118,7 @@ class Contest extends BaseApiEntity implements options: ['comment' => 'Time after which no more submissions are accepted', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $endtime; + private ?float $endtime; #[ORM\Column( type: 'decimal', @@ -128,7 +128,7 @@ class Contest extends BaseApiEntity implements options: ['comment' => 'Unfreeze a frozen scoreboard at this time', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $unfreezetime = null; + private ?float $unfreezetime = null; #[ORM\Column( type: 'decimal', @@ -138,7 +138,7 @@ class Contest extends BaseApiEntity implements options: ['comment' => 'Time when contest was finalized, null if not yet', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $finalizetime = null; + private ?float $finalizetime = null; #[ORM\Column( type: 'text', @@ -213,7 +213,7 @@ public function getScoreboardTypeString(): string options: ['comment' => 'Time contest becomes invisible in team/public views', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $deactivatetime = null; + private ?float $deactivatetime = null; #[ORM\Column( length: 64, @@ -513,7 +513,7 @@ public function getActivatetime(): ?float return $this->activatetime === null ? null : (float)$this->activatetime; } - public function setStarttime(string|float $starttime): Contest + public function setStarttime(float $starttime): Contest { $this->starttime = $starttime; return $this; @@ -581,7 +581,7 @@ public function getFinalizetime(): ?float return $this->finalizetime === null ? null : (float)$this->finalizetime; } - public function setFinalizetime(string|float|null $finalizetimeString): Contest + public function setFinalizetime(?float $finalizetimeString): Contest { $this->finalizetime = $finalizetimeString; return $this; @@ -699,34 +699,31 @@ public function getDeactivatetimeString(): ?string return $this->deactivatetimeString; } - public function setActivatetime(string $activatetime): Contest + public function setActivatetime(float $activatetime): Contest { $this->activatetime = $activatetime; return $this; } - public function setFreezetime(string $freezetime): Contest + public function setFreezetime(float $freezetime): Contest { $this->freezetime = $freezetime; return $this; } - public function setEndtime(string $endtime): Contest + public function setEndtime(float $endtime): Contest { $this->endtime = $endtime; return $this; } - /** - * @param string|float $unfreezetime - */ - public function setUnfreezetime($unfreezetime): Contest + public function setUnfreezetime(float $unfreezetime): Contest { $this->unfreezetime = $unfreezetime; return $this; } - public function setDeactivatetime(string $deactivatetime): Contest + public function setDeactivatetime(float $deactivatetime): Contest { $this->deactivatetime = $deactivatetime; return $this; @@ -1045,7 +1042,7 @@ public function isActive(): bool ($this->deactivatetime == null || $this->deactivatetime > time()); } - public function getAbsoluteTime(?string $time_string): float|int|string|null + public function getAbsoluteTime(?string $time_string): float|int|null { if ($time_string === null) { return null; @@ -1076,7 +1073,7 @@ public function getAbsoluteTime(?string $time_string): float|int|string|null } catch (Exception) { return null; } - return $date->format('U.v'); + return (float)$date->format('U.v'); } } diff --git a/webapp/src/Entity/Event.php b/webapp/src/Entity/Event.php index 2cacbb6eb6..be19b66811 100644 --- a/webapp/src/Entity/Event.php +++ b/webapp/src/Entity/Event.php @@ -29,7 +29,7 @@ class Event scale: 9, options: ['comment' => 'When the event occurred', 'unsigned' => true] )] - private string|float $eventtime; + private float $eventtime; #[ORM\Column(length: 32, options: ['comment' => 'API endpoint associated to this entry'])] private string $endpointtype; @@ -64,13 +64,13 @@ public function getEventid(): int return $this->eventid; } - public function setEventtime(string|float $eventtime): Event + public function setEventtime(float $eventtime): Event { $this->eventtime = $eventtime; return $this; } - public function getEventtime(): string|float + public function getEventtime(): float { return $this->eventtime; } diff --git a/webapp/src/Entity/ExternalContestSource.php b/webapp/src/Entity/ExternalContestSource.php index c715724eb5..5107af823f 100644 --- a/webapp/src/Entity/ExternalContestSource.php +++ b/webapp/src/Entity/ExternalContestSource.php @@ -47,7 +47,7 @@ class ExternalContestSource nullable: true, options: ['comment' => 'Time of last poll by event feed reader', 'unsigned' => true] )] - private string|float|null $lastPollTime = null; + private ?float $lastPollTime = null; #[ORM\Column( type: 'smallint', @@ -139,12 +139,12 @@ public function setLastEventId(?string $lastEventId): ExternalContestSource return $this; } - public function getLastPollTime(): string|float|null + public function getLastPollTime(): float|null { return $this->lastPollTime; } - public function setLastPollTime(string|float|null $lastPollTime): ExternalContestSource + public function setLastPollTime(?float $lastPollTime): ExternalContestSource { $this->lastPollTime = $lastPollTime; return $this; diff --git a/webapp/src/Entity/ExternalJudgement.php b/webapp/src/Entity/ExternalJudgement.php index 95bc555897..92bf7a2562 100644 --- a/webapp/src/Entity/ExternalJudgement.php +++ b/webapp/src/Entity/ExternalJudgement.php @@ -68,7 +68,7 @@ class ExternalJudgement scale: 9, options: ['comment' => 'Time judging started', 'unsigned' => true] )] - private string|float $starttime; + private float $starttime; #[ORM\Column( type: 'decimal', @@ -77,7 +77,7 @@ class ExternalJudgement nullable: true, options: ['comment' => 'Time judging ended, null = still busy', 'unsigned' => true] )] - private string|float|null $endtime = null; + private ?float $endtime = null; #[ORM\Column( options: ['comment' => 'Old external judgement is marked as invalid when receiving a new one', 'default' => 1] @@ -163,24 +163,24 @@ public function getVerifyComment(): ?string return $this->verify_comment; } - public function setStarttime(string|float $starttime): ExternalJudgement + public function setStarttime(float $starttime): ExternalJudgement { $this->starttime = $starttime; return $this; } - public function getStarttime(): string|float + public function getStarttime(): float { return $this->starttime; } - public function setEndtime(string|float|null $endtime): ExternalJudgement + public function setEndtime(?float $endtime): ExternalJudgement { $this->endtime = $endtime; return $this; } - public function getEndtime(): string|float|null + public function getEndtime(): float|null { return $this->endtime; } diff --git a/webapp/src/Entity/ExternalRun.php b/webapp/src/Entity/ExternalRun.php index cd6e86ed16..9b0849b14a 100644 --- a/webapp/src/Entity/ExternalRun.php +++ b/webapp/src/Entity/ExternalRun.php @@ -45,7 +45,7 @@ class ExternalRun scale: 9, options: ['comment' => 'Time run ended', 'unsigned' => true] )] - private string|float $endtime; + private float $endtime; #[ORM\Column(options: ['comment' => 'Running time on this testcase'])] private float $runtime; @@ -89,13 +89,13 @@ public function getResult(): string return $this->result; } - public function setEndtime(string|float $endtime): ExternalRun + public function setEndtime(float $endtime): ExternalRun { $this->endtime = $endtime; return $this; } - public function getEndtime(): string|float + public function getEndtime(): float { return $this->endtime; } diff --git a/webapp/src/Entity/InternalError.php b/webapp/src/Entity/InternalError.php index 32cd54a6d6..422006789d 100644 --- a/webapp/src/Entity/InternalError.php +++ b/webapp/src/Entity/InternalError.php @@ -43,7 +43,7 @@ class InternalError scale: 9, options: ['comment' => 'Timestamp of the internal error', 'unsigned' => true] )] - private string|float $time; + private float $time; /** * @var array{kind: string, hostname?: string, execid?: string, probid: string, langid: string} @@ -118,13 +118,13 @@ public function getJudgehostlog(): string return $this->judgehostlog; } - public function setTime(string|float $time): InternalError + public function setTime(float $time): InternalError { $this->time = $time; return $this; } - public function getTime(): string|float + public function getTime(): float { return $this->time; } diff --git a/webapp/src/Entity/JudgeTask.php b/webapp/src/Entity/JudgeTask.php index 513efebee1..0339e5bd57 100644 --- a/webapp/src/Entity/JudgeTask.php +++ b/webapp/src/Entity/JudgeTask.php @@ -152,7 +152,7 @@ public function getSubmitid(): ?int options: ['comment' => 'Time the judgetask was started', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $starttime = null; + private ?float $starttime = null; /** * @var Collection @@ -341,13 +341,13 @@ public function getValid(): bool return $this->valid; } - public function setStarttime(string|float|null $starttime): JudgeTask + public function setStarttime(?float $starttime): JudgeTask { $this->starttime = $starttime; return $this; } - public function getStarttime(): string|float|null + public function getStarttime(): float|null { return $this->starttime; } diff --git a/webapp/src/Entity/Judgehost.php b/webapp/src/Entity/Judgehost.php index 7d72e19b06..8f979b73cc 100644 --- a/webapp/src/Entity/Judgehost.php +++ b/webapp/src/Entity/Judgehost.php @@ -42,7 +42,7 @@ class Judgehost options: ['comment' => 'Time of last poll by autojudger', 'unsigned' => true] )] #[OA\Property(nullable: true)] - private string|float|null $polltime = null; + private ?float $polltime = null; /** * @var Collection @@ -91,13 +91,13 @@ public function getEnabled(): bool return $this->enabled; } - public function setPolltime(string|float $polltime): Judgehost + public function setPolltime(float $polltime): Judgehost { $this->polltime = $polltime; return $this; } - public function getPolltime(): string|float|null + public function getPolltime(): float|null { return $this->polltime; } diff --git a/webapp/src/Entity/Judging.php b/webapp/src/Entity/Judging.php index da14eff906..d93915cfa3 100644 --- a/webapp/src/Entity/Judging.php +++ b/webapp/src/Entity/Judging.php @@ -43,7 +43,7 @@ class Judging extends BaseApiEntity options: ['comment' => 'Time judging started', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $starttime = null; + private ?float $starttime = null; #[ORM\Column( type: 'decimal', @@ -54,7 +54,7 @@ class Judging extends BaseApiEntity )] #[OA\Property(nullable: true)] #[Serializer\Exclude] - private string|float|null $endtime = null; + private ?float $endtime = null; #[ORM\Column( type: 'decimal', @@ -64,7 +64,7 @@ class Judging extends BaseApiEntity options: ['comment' => 'The maximum runtime for all runs that resulted in the verdict', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $maxRuntimeForVerdict = null; + private ?float $maxRuntimeForVerdict = null; #[ORM\Column( length: 32, @@ -203,13 +203,13 @@ public function getJudgingid(): int return $this->judgingid; } - public function setStarttime(string|float $starttime): Judging + public function setStarttime(float $starttime): Judging { $this->starttime = $starttime; return $this; } - public function getStarttime(): string|float|null + public function getStarttime(): float|null { return $this->starttime; } @@ -231,13 +231,13 @@ public function getRelativeStartTime(): string return Utils::relTime($this->getStarttime() - $this->getContest()->getStarttime()); } - public function setEndtime(string|float $endtime): Judging + public function setEndtime(float $endtime): Judging { $this->endtime = $endtime; return $this; } - public function getEndtime(): string|float|null + public function getEndtime(): float|null { return $this->endtime; } @@ -260,13 +260,13 @@ public function getRelativeEndTime(): ?string return $this->getEndtime() ? Utils::relTime($this->getEndtime() - $this->getContest()->getStarttime()) : null; } - public function setMaxRuntimeForVerdict(string|float $maxRuntimeForVerdict): Judging + public function setMaxRuntimeForVerdict(float $maxRuntimeForVerdict): Judging { $this->maxRuntimeForVerdict = $maxRuntimeForVerdict; return $this; } - public function getMaxRuntimeForVerdict(): string|float|null + public function getMaxRuntimeForVerdict(): float|null { return $this->maxRuntimeForVerdict; } diff --git a/webapp/src/Entity/JudgingRun.php b/webapp/src/Entity/JudgingRun.php index dc1966a575..0d06844af9 100644 --- a/webapp/src/Entity/JudgingRun.php +++ b/webapp/src/Entity/JudgingRun.php @@ -58,7 +58,7 @@ class JudgingRun extends BaseApiEntity options: ['comment' => 'Time run judging ended', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $endtime = null; + private ?float $endtime = null; #[ORM\Column( type: 'decimal', @@ -68,7 +68,7 @@ class JudgingRun extends BaseApiEntity options: ['comment' => 'Time run judging started', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $startTime = null; + private ?float $startTime = null; #[ORM\ManyToOne(inversedBy: 'runs')] #[ORM\JoinColumn(name: 'judgingid', referencedColumnName: 'judgingid', onDelete: 'CASCADE')] @@ -161,24 +161,24 @@ public function getRuntime(): ?float return Utils::roundedFloat($this->runtime); } - public function setEndtime(string|float $endtime): JudgingRun + public function setEndtime(float $endtime): JudgingRun { $this->endtime = $endtime; return $this; } - public function setStarttime(string|float $startTime): JudgingRun + public function setStarttime(float $startTime): JudgingRun { $this->startTime = $startTime; return $this; } - public function getStarttime(): string|float|null + public function getStarttime(): float|null { return $this->startTime; } - public function getEndtime(): string|float|null + public function getEndtime(): float|null { return $this->endtime; } diff --git a/webapp/src/Entity/QueueTask.php b/webapp/src/Entity/QueueTask.php index 45835fcaf4..8753ea4361 100644 --- a/webapp/src/Entity/QueueTask.php +++ b/webapp/src/Entity/QueueTask.php @@ -120,7 +120,7 @@ public function setStartTime(?float $startTime = null): QueueTask return $this; } - public function getStartTime(): string|float|null + public function getStartTime(): float|null { return $this->startTime; } diff --git a/webapp/src/Entity/RankCache.php b/webapp/src/Entity/RankCache.php index d1f25640eb..1c57cfd4b0 100644 --- a/webapp/src/Entity/RankCache.php +++ b/webapp/src/Entity/RankCache.php @@ -19,10 +19,12 @@ #[ORM\Index(columns: ['cid', 'points_public', 'totaltime_public', 'totalruntime_public'], name: 'order_public')] #[ORM\Index(columns: ['cid'], name: 'cid')] #[ORM\Index(columns: ['teamid'], name: 'teamid')] -#[ORM\Index(columns: ['sort_key_public'], name: 'sortKeyPublic')] -#[ORM\Index(columns: ['sort_key_restricted'], name: 'sortKeyRestricted')] +#[ORM\Index(columns: ['sort_key_public'], name: 'sortKeyPublic', options: ['lengths' => [self::SORT_KEY_INDEX_SIZE]])] +#[ORM\Index(columns: ['sort_key_restricted'], name: 'sortKeyRestricted', options: ['lengths' => [self::SORT_KEY_INDEX_SIZE]])] class RankCache { + public const SORT_KEY_INDEX_SIZE = 768; + #[ORM\Column(options: [ 'comment' => 'Total correctness points (restricted audience)', 'unsigned' => true, diff --git a/webapp/src/Entity/Rejudging.php b/webapp/src/Entity/Rejudging.php index ea60dd2ce6..d17d536c8b 100644 --- a/webapp/src/Entity/Rejudging.php +++ b/webapp/src/Entity/Rejudging.php @@ -31,7 +31,7 @@ class Rejudging scale: 9, options: ['comment' => 'Time rejudging started', 'unsigned' => true] )] - private string|float $starttime; + private float $starttime; #[ORM\Column( type: 'decimal', @@ -40,7 +40,7 @@ class Rejudging nullable: true, options: ['comment' => 'Time rejudging ended, null = still busy', 'unsigned' => true] )] - private string|float|null $endtime = null; + private ?float $endtime = null; #[ORM\Column(options: ['comment' => 'Reason to start this rejudge'])] private string $reason; @@ -107,24 +107,24 @@ public function getRejudgingid(): int return $this->rejudgingid; } - public function setStarttime(string|float $starttime): Rejudging + public function setStarttime(float $starttime): Rejudging { $this->starttime = $starttime; return $this; } - public function getStarttime(): string|float + public function getStarttime(): float { return $this->starttime; } - public function setEndtime(string|float $endtime): Rejudging + public function setEndtime(float $endtime): Rejudging { $this->endtime = $endtime; return $this; } - public function getEndtime(): string|float|null + public function getEndtime(): float|null { return $this->endtime; } diff --git a/webapp/src/Entity/RemovedInterval.php b/webapp/src/Entity/RemovedInterval.php index f853da5d39..3f9f97ce8f 100644 --- a/webapp/src/Entity/RemovedInterval.php +++ b/webapp/src/Entity/RemovedInterval.php @@ -33,7 +33,7 @@ class RemovedInterval scale: 9, options: ['comment' => 'Initial time of removed interval', 'unsigned' => true] )] - private string|float $starttime; + private float $starttime; #[ORM\Column( type: 'decimal', @@ -41,7 +41,7 @@ class RemovedInterval scale: 9, options: ['comment' => 'Final time of removed interval', 'unsigned' => true] )] - private string|float $endtime; + private float $endtime; #[ORM\Column( length: 64, @@ -66,24 +66,24 @@ public function getIntervalid(): ?int return $this->intervalid; } - public function setStarttime(string|float $starttime): RemovedInterval + public function setStarttime(float $starttime): RemovedInterval { $this->starttime = $starttime; return $this; } - public function getStarttime(): string|float + public function getStarttime(): float { return $this->starttime; } - public function setEndtime(string|float $endtime): RemovedInterval + public function setEndtime(float $endtime): RemovedInterval { $this->endtime = $endtime; return $this; } - public function getEndtime(): string|float + public function getEndtime(): float { return $this->endtime; } @@ -95,7 +95,7 @@ public function setStarttimeString(string $starttimeString): RemovedInterval { $this->starttimeString = $starttimeString; $date = new DateTime($starttimeString); - $this->starttime = $date->format('U.v'); + $this->starttime = (float)$date->format('U.v'); return $this; } @@ -112,7 +112,7 @@ public function setEndtimeString(string $endtimeString): RemovedInterval { $this->endtimeString = $endtimeString; $date = new DateTime($endtimeString); - $this->endtime = $date->format('U.v'); + $this->endtime = (float)$date->format('U.v'); return $this; } diff --git a/webapp/src/Entity/ScoreCache.php b/webapp/src/Entity/ScoreCache.php index 67aa8bcf0b..8a72e9a404 100644 --- a/webapp/src/Entity/ScoreCache.php +++ b/webapp/src/Entity/ScoreCache.php @@ -49,7 +49,7 @@ class ScoreCache 'default' => '0.000000000', ] )] - private string|float $solvetime_restricted = 0; + private float $solvetime_restricted = 0; #[ORM\Column(options: [ 'comment' => 'Runtime in milliseconds (restricted audience)', @@ -83,7 +83,7 @@ class ScoreCache 'default' => '0.000000000', ] )] - private string|float $solvetime_public = 0; + private float $solvetime_public = 0; #[ORM\Column(options: ['comment' => 'Runtime in milliseconds (public)', 'default' => 0])] private int $runtime_public = 0; @@ -142,13 +142,13 @@ public function getIsCorrectRestricted(): bool return $this->is_correct_restricted; } - public function setSolvetimeRestricted(string|float $solvetimeRestricted): ScoreCache + public function setSolvetimeRestricted(float $solvetimeRestricted): ScoreCache { $this->solvetime_restricted = $solvetimeRestricted; return $this; } - public function getSolvetimeRestricted(): string|float + public function getSolvetimeRestricted(): float { return $this->solvetime_restricted; } @@ -197,13 +197,13 @@ public function getIsCorrectPublic(): bool return $this->is_correct_public; } - public function setSolvetimePublic(string|float $solvetimePublic): ScoreCache + public function setSolvetimePublic(float $solvetimePublic): ScoreCache { $this->solvetime_public = $solvetimePublic; return $this; } - public function getSolvetimePublic(): string|float + public function getSolvetimePublic(): float { return $this->solvetime_public; } @@ -273,7 +273,7 @@ public function getPending(bool $restricted): int return $restricted ? $this->getPendingRestricted() : $this->getPendingPublic(); } - public function getSolveTime(bool $restricted): string|float + public function getSolveTime(bool $restricted): float { return $restricted ? $this->getSolvetimeRestricted() : $this->getSolvetimePublic(); } diff --git a/webapp/src/Entity/Submission.php b/webapp/src/Entity/Submission.php index 35a82b4bce..ad7569baa3 100644 --- a/webapp/src/Entity/Submission.php +++ b/webapp/src/Entity/Submission.php @@ -66,7 +66,7 @@ class Submission extends BaseApiEntity implements options: ['comment' => 'Time submitted', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $submittime = null; + private ?float $submittime = null; #[ORM\Column(options: [ 'comment' => 'If false ignore this submission in all scoreboard calculations', @@ -104,6 +104,7 @@ class Submission extends BaseApiEntity implements #[ORM\Column(options: [ 'comment' => 'Where did we receive this submission from?', + 'default' => SubmissionSource::UNKNOWN, ])] #[Serializer\Exclude] private SubmissionSource $source = SubmissionSource::UNKNOWN; @@ -231,13 +232,13 @@ public function getLanguageId(): string return $this->getLanguage()->getExternalid(); } - public function setSubmittime(string|float $submittime): Submission + public function setSubmittime(float $submittime): Submission { $this->submittime = $submittime; return $this; } - public function getSubmittime(): string|float + public function getSubmittime(): float { return $this->submittime; } diff --git a/webapp/src/Entity/Team.php b/webapp/src/Entity/Team.php index fd9d4e4ef2..a66caa785f 100644 --- a/webapp/src/Entity/Team.php +++ b/webapp/src/Entity/Team.php @@ -114,7 +114,7 @@ class Team extends BaseApiEntity implements options: ['comment' => 'Start time of last judging for prioritization', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $judging_last_started = null; + private ?float $judging_last_started = null; #[ORM\Column(options: ['comment' => 'Additional penalty time in minutes', 'default' => 0])] #[Serializer\Exclude] @@ -327,13 +327,13 @@ public function getInternalComments(): ?string return $this->internalComments; } - public function setJudgingLastStarted(string|float $judgingLastStarted): Team + public function setJudgingLastStarted(float $judgingLastStarted): Team { $this->judging_last_started = $judgingLastStarted; return $this; } - public function getJudgingLastStarted(): string|float + public function getJudgingLastStarted(): float { return $this->judging_last_started; } diff --git a/webapp/src/Entity/User.php b/webapp/src/Entity/User.php index 20a54dcfdb..650ad9f2ed 100644 --- a/webapp/src/Entity/User.php +++ b/webapp/src/Entity/User.php @@ -73,7 +73,7 @@ class User extends BaseApiEntity implements )] #[OA\Property(nullable: true)] #[Serializer\Exclude] - private string|float|null $last_login = null; + private ?float $last_login = null; #[ORM\Column( type: 'decimal', @@ -84,7 +84,7 @@ class User extends BaseApiEntity implements )] #[OA\Property(nullable: true)] #[Serializer\Exclude] - private string|float|null $last_api_login = null; + private ?float $last_api_login = null; #[ORM\Column( type: 'decimal', @@ -95,7 +95,7 @@ class User extends BaseApiEntity implements )] #[OA\Property(nullable: true)] #[Serializer\Exclude] - private string|float|null $first_login = null; + private ?float $first_login = null; #[ORM\Column(nullable: true, options: ['comment' => 'Last IP address of successful login'])] #[OA\Property(nullable: true)] @@ -228,13 +228,13 @@ public function getEmail(): ?string return $this->email; } - public function setLastLogin(string|float|null $lastLogin): User + public function setLastLogin(?float $lastLogin): User { $this->last_login = $lastLogin; return $this; } - public function getLastLogin(): string|float|null + public function getLastLogin(): float|null { return $this->last_login; } @@ -249,13 +249,13 @@ public function getLastLoginAsDateTime(): ?DateTime return $this->getLastLogin() ? new DateTime(Utils::absTime($this->getLastLogin())) : null; } - public function setLastApiLogin(string|float|null $lastApiLogin): User + public function setLastApiLogin(?float $lastApiLogin): User { $this->last_api_login = $lastApiLogin; return $this; } - public function getLastApiLogin(): string|float|null + public function getLastApiLogin(): float|null { return $this->last_api_login; } @@ -270,13 +270,13 @@ public function getLastApiLoginAsDateTime(): ?DateTime return $this->getLastApiLogin() ? new DateTime(Utils::absTime($this->getLastApiLogin())) : null; } - public function setFirstLogin(string|float|null $firstLogin): User + public function setFirstLogin(?float $firstLogin): User { $this->first_login = $firstLogin; return $this; } - public function getFirstLogin(): string|float|null + public function getFirstLogin(): float|null { return $this->first_login; } diff --git a/webapp/src/Entity/Version.php b/webapp/src/Entity/Version.php index f78a98212a..34ac3cb530 100644 --- a/webapp/src/Entity/Version.php +++ b/webapp/src/Entity/Version.php @@ -52,7 +52,7 @@ class Version options: ['comment' => 'Time this version command output was last updated', 'unsigned' => true] )] #[Serializer\Exclude] - private string|float|null $lastChangedTime = null; + private ?float $lastChangedTime = null; #[ORM\Column(options: [ 'comment' => 'True if this version is active for this judgehost/language combination.', diff --git a/webapp/src/Service/EventLogService.php b/webapp/src/Service/EventLogService.php index 0810ec9805..93d54eb439 100644 --- a/webapp/src/Service/EventLogService.php +++ b/webapp/src/Service/EventLogService.php @@ -334,9 +334,9 @@ public function log( } } - // Explicitly construct the time as string to prevent float - // representation issues. - $now = sprintf('%.3f', microtime(true)); + // Explicitly construct the time as string and then cast to float + // to prevent float representation issues. + $now = (float)sprintf('%.3f', microtime(true)); if ($jsonPassed) { $json = Utils::jsonDecode($json);