Skip to content
Draft
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
12 changes: 11 additions & 1 deletion webapp/src/Service/ImportExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public function importContestData(mixed $data, ?string &$errorMessage = null, ?s
/**
* @param array{name?: string, short-name?: string, id?: string, label?: string,
* letter?: string, time_limit?: int, rgb?: string, color?: string,
* problems?: array{name?: string, short-name?: string, id?: string, label?: string,
* problems?: array{name?: string|array<string, string>, short-name?: string, id?: string, label?: string,
* letter?: string, label?: string, letter?: string}} $problems
* @param string[]|null $ids
* @param array<string, string[]> $messages
Expand All @@ -413,6 +413,16 @@ public function importProblemsData(Contest $contest, array $problems, ?array &$i
$problemName = $problemData['name'] ?? $problemData['short-name'] ?? $problemData['id'] ?? null;
$problemLabel = $problemData['label'] ?? $problemData['letter'] ?? null;

// The 2025-09 problem spec allows a 'language code'->'name' map.
if (is_array($problemName)) {
if (array_key_exists('en', $problemName)) {
$problemName = $problemName['en'];
} else {
$errorMessage = sprintf("Problem '%s' should have an English name", $problemName['id']);
return false;
}
}

$problem = new Problem();
$problem
->setName($problemName)
Expand Down
Loading