Skip to content

Commit b4cdfbe

Browse files
PC^2 does not send timelimits for problems, so make them optional.
1 parent 1f7e467 commit b4cdfbe

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

webapp/src/DataTransferObject/Shadowing/ProblemEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class ProblemEvent implements EventData
77
public function __construct(
88
public readonly string $id,
99
public readonly string $name,
10-
public readonly int $timeLimit,
10+
public readonly ?int $timeLimit,
1111
public readonly ?string $label,
1212
public readonly ?string $rgb,
1313
) {}

webapp/src/Service/ExternalContestSourceService.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,10 +1024,13 @@ protected function validateAndUpdateProblem(Event $event, EventData $data): void
10241024
$this->removeWarning($event->type, $data->id, ExternalSourceWarning::TYPE_ENTITY_NOT_FOUND);
10251025

10261026
$toCheckProblem = [
1027-
'name' => $data->name,
1028-
'timelimit' => $data->timeLimit,
1027+
'name' => $data->name,
10291028
];
10301029

1030+
if ($data->timeLimit !== null) {
1031+
$toCheckProblem['timelimit'] = $data->timeLimit;
1032+
}
1033+
10311034
/* Disable as PC2 can have 2 problems with the same label
10321035
if ($contestProblem->getShortname() !== $data->label) {
10331036
if ($contestProblem->getShortname() !== $data['label']) {

0 commit comments

Comments
 (0)