Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions webapp/migrations/Version20250309122806.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace DoctrineMigrations;

use App\Entity\RankCache;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion webapp/migrations/Version20250323190305.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class Version20250323190305 extends AbstractMigration
{
public function getDescription(): string
{
return '';
return 'Add problem types';
}

public function up(Schema $schema): void
Expand Down
38 changes: 38 additions & 0 deletions webapp/migrations/Version20250620082406.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250620082406 extends AbstractMigration
{
public function getDescription(): string
{
return 'Change comments to reflect entities';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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\'');
$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;
}
}
8 changes: 4 additions & 4 deletions webapp/src/Controller/API/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/Entity/AuditLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/Entity/Clarification.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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;
}
Expand Down
35 changes: 16 additions & 19 deletions webapp/src/Entity/Contest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
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',
Expand All @@ -92,7 +92,7 @@
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',
Expand All @@ -109,7 +109,7 @@
options: ['comment' => 'Time scoreboard is frozen', 'unsigned' => true]
)]
#[Serializer\Exclude]
private string|float|null $freezetime = null;
private ?float $freezetime = null;

#[ORM\Column(
type: 'decimal',
Expand All @@ -118,7 +118,7 @@
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',
Expand All @@ -128,7 +128,7 @@
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',
Expand All @@ -138,7 +138,7 @@
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',
Expand Down Expand Up @@ -213,7 +213,7 @@
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,
Expand Down Expand Up @@ -513,7 +513,7 @@
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;
Expand Down Expand Up @@ -581,7 +581,7 @@
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;
Expand Down Expand Up @@ -699,34 +699,31 @@
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;
Expand Down Expand Up @@ -1045,7 +1042,7 @@
($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;
Expand Down Expand Up @@ -1076,7 +1073,7 @@
} catch (Exception) {
return null;
}
return $date->format('U.v');
return (float)$date->format('U.v');
}
}

Expand Down Expand Up @@ -1280,7 +1277,7 @@
{
foreach (['Activate', 'Deactivate', 'Start', 'End', 'Freeze', 'Unfreeze'] as $timeString) {
$tmpValue = $this->{'get' . $timeString . 'timeString'}();
if ($tmpValue === null) continue;

Check failure on line 1280 in webapp/src/Entity/Contest.php

View workflow job for this annotation

GitHub Actions / phpcs

Inline control structures are not allowed
try {
$this->checkValidTimeString($tmpValue);
} catch (Exception $e) {
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/Entity/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/Entity/ExternalContestSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions webapp/src/Entity/ExternalJudgement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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]
Expand Down Expand Up @@ -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;
}
Expand Down
Loading
Loading