diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index b5772ef711..d43788bb2a 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -22,6 +22,7 @@ jobs: path: webapp/src webapp/tests php_extensions: gd intl mysqli pcntl zip autoload_file: webapp/vendor/autoload.php + version: composer - uses: actions/upload-artifact@v4 if: always() with: diff --git a/webapp/src/Command/ImportEventFeedCommand.php b/webapp/src/Command/ImportEventFeedCommand.php index 4b1960059b..f8060805c4 100644 --- a/webapp/src/Command/ImportEventFeedCommand.php +++ b/webapp/src/Command/ImportEventFeedCommand.php @@ -223,10 +223,12 @@ protected function compareContestId(): bool $ourId = $contest->getExternalid(); $theirId = $this->sourceService->getContestId(); if ($ourId !== $theirId) { - $this->style->error( + $this->style->warning( "Contest ID in external system $theirId does not match external ID in DOMjudge ($ourId)." ); - return false; + if (!$this->style->confirm('Do you want to continue anyway?', default: false)) { + return false; + } } return true; diff --git a/webapp/src/DataTransferObject/ApiInfo.php b/webapp/src/DataTransferObject/ApiInfo.php index 17a8f5ed56..b5a08c0528 100644 --- a/webapp/src/DataTransferObject/ApiInfo.php +++ b/webapp/src/DataTransferObject/ApiInfo.php @@ -7,8 +7,8 @@ class ApiInfo { public function __construct( - public readonly string $version, - public readonly string $versionUrl, + public readonly ?string $version, + public readonly ?string $versionUrl, public readonly string $name, public readonly ?ApiInfoProvider $provider, #[Serializer\Exclude(if: '!object.domjudge')] diff --git a/webapp/src/DataTransferObject/Shadowing/ProblemEvent.php b/webapp/src/DataTransferObject/Shadowing/ProblemEvent.php index 7c5b76d348..95a1701e8e 100644 --- a/webapp/src/DataTransferObject/Shadowing/ProblemEvent.php +++ b/webapp/src/DataTransferObject/Shadowing/ProblemEvent.php @@ -7,7 +7,7 @@ class ProblemEvent implements EventData public function __construct( public readonly string $id, public readonly string $name, - public readonly float $timeLimit, + public readonly ?float $timeLimit, public readonly ?string $label, public readonly ?string $rgb, ) {} diff --git a/webapp/src/Service/ExternalContestSourceService.php b/webapp/src/Service/ExternalContestSourceService.php index f50ccee457..3d0212d523 100644 --- a/webapp/src/Service/ExternalContestSourceService.php +++ b/webapp/src/Service/ExternalContestSourceService.php @@ -1027,9 +1027,12 @@ protected function validateAndUpdateProblem(Event $event, EventData $data): void $toCheckProblem = [ 'name' => $data->name, - 'timelimit' => $data->timeLimit, ]; + if ($data->timeLimit) { + $toCheckProblem['timelimit'] = $data->timeLimit; + } + if ($contestProblem->getShortname() !== $data->label) { $this->logger->warning( 'Contest problem short name does not match between feed (%s) and local (%s), updating', @@ -1097,7 +1100,10 @@ protected function validateAndUpdateTeam(Event $event, EventData $data): void if (!empty($data->organizationId)) { $affiliation = $this->em->getRepository(TeamAffiliation::class)->findOneBy(['externalid' => $data->organizationId]); if (!$affiliation) { + // Affiliation does not exist. Create one with a dummy name so we can continue. $affiliation = new TeamAffiliation(); + $affiliation->setName($data->organizationId); + $affiliation->setShortname(substr($data->organizationId, 0, 32)); $this->em->persist($affiliation); } $team->setAffiliation($affiliation); @@ -1106,7 +1112,9 @@ protected function validateAndUpdateTeam(Event $event, EventData $data): void if (!empty($data->groupIds[0])) { $category = $this->em->getRepository(TeamCategory::class)->findOneBy(['externalid' => $data->groupIds[0]]); if (!$category) { + // Category does not exist. Create one with a dummy name so we can continue. $category = new TeamCategory(); + $category->setName($data->groupIds[0]); $this->em->persist($category); } $team->setCategory($category);