Skip to content

Commit ac920ac

Browse files
Make shadow importing more resilient
1 parent 64f41be commit ac920ac

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

webapp/src/DataTransferObject/Shadowing/ContestEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function __construct(
99
public readonly string $name,
1010
public readonly string $duration,
1111
public readonly ?string $scoreboardType,
12-
public readonly int $penaltyTime,
12+
public readonly ?int $penaltyTime,
1313
public readonly ?string $formalName,
1414
public readonly ?string $startTime,
1515
public readonly ?string $countdownPauseTime,

webapp/src/Service/ExternalContestSourceService.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ protected function validateAndUpdateContest(Event $event, EventData $data): void
766766

767767
// Also compare the penalty time
768768
$penaltyTime = $data->penaltyTime;
769-
if ($this->config->get('penalty_time') != $penaltyTime) {
769+
if ($penaltyTime !== null && $this->config->get('penalty_time') != $penaltyTime) {
770770
$this->logger->warning(
771771
'Penalty time does not match between feed (%d) and local (%d)',
772772
[$penaltyTime, $this->config->get('penalty_time')]
@@ -863,9 +863,11 @@ protected function validateLanguage(Event $event, EventData $data): void
863863
} else {
864864
$this->removeWarning($event->type, $data->id, ExternalSourceWarning::TYPE_DATA_MISMATCH);
865865

866-
$toCheck = ['extensions' => $data->extensions];
866+
if ($data->extensions !== null) {
867+
$toCheck = ['extensions' => $data->extensions];
867868

868-
$this->compareOrCreateValues($event, $data->id, $language, $toCheck);
869+
$this->compareOrCreateValues($event, $data->id, $language, $toCheck);
870+
}
869871
}
870872
}
871873

0 commit comments

Comments
 (0)