Skip to content

Commit 06082e8

Browse files
meisterTnickygerritsen
authored andcommitted
Properly set validation mode for interactive problems without validation: custom.
1 parent 7175113 commit 06082e8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

webapp/src/Service/ImportProblemService.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,10 +1025,14 @@ public static function parseYaml(bool|string $problemYaml, array &$messages, str
10251025
}
10261026
}
10271027

1028+
$validationMode = 'default';
10281029
if (isset($yamlData['type'])) {
10291030
$types = explode(' ', $yamlData['type']);
10301031
// Validation happens later when we set the properties.
10311032
$yamlProblemProperties['typesAsString'] = $types;
1033+
if (in_array('interactive', $types)) {
1034+
$validationMode = 'custom interactive';
1035+
}
10321036
} else {
10331037
$yamlProblemProperties['typesAsString'] = ['pass-fail'];
10341038
}
@@ -1037,7 +1041,6 @@ public static function parseYaml(bool|string $problemYaml, array &$messages, str
10371041
$yamlProblemProperties['special_compare_args'] = $yamlData['validator_flags'];
10381042
}
10391043

1040-
$validationMode = 'default';
10411044
if (isset($yamlData['validation'])
10421045
&& ($yamlData['validation'] == 'custom' ||
10431046
$yamlData['validation'] == 'custom interactive' ||

webapp/tests/Unit/Service/ImportProblemServiceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public function testKattisExample()
294294
$this->assertEmpty($messages);
295295
$this->assertEquals('Guess the Number', $problem->getName());
296296
$this->assertEquals('pass-fail, interactive', $problem->getTypesAsString());
297-
$this->assertEquals('default', $validationMode);
297+
$this->assertEquals('custom interactive', $validationMode);
298298
$this->assertEquals(0, $problem->getTimelimit());
299299
$this->assertEquals(null, $problem->getMemlimit());
300300
$this->assertEquals(null, $problem->getOutputlimit());

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy