Skip to content

Consistently use (de)activate_time in contest.yaml. #2036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions doc/manual/config-basic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ from the main page.
Besides the name the most important configuration about a contest
are the various time milestones.

A contest can be selected for viewing after its *activation time*, but
A contest can be selected for viewing after its *activate time*, but
the scoreboard will only become visible to public and teams once the
contest *starts*. Thus no data such as problems and teams is revealed
before then.

When the contest *ends*, the scores will remain displayed until the
*deactivation time* passes.
*deactivate time* passes.

DOMjudge has the option to 'freeze' the public and team scoreboards
at some point during the contest. This means that scores are no longer
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/Service/ImportExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getContestYamlData(Contest $contest, bool $includeProblems = tru
'end_time' => Utils::absTime($contest->getEndtime(), true),
'duration' => Utils::relTime($contest->getContestTime((float)$contest->getEndtime())),
'penalty_time' => $this->config->get('penalty_time'),
'activation_time' => Utils::absTime($contest->getActivatetime(), true),
'activate_time' => Utils::absTime($contest->getActivatetime(), true),
];
if ($warnMsg = $contest->getWarningMessage()) {
$data['warning_message'] = $warnMsg;
Expand Down Expand Up @@ -143,7 +143,7 @@ public function importContestData($data, ?string &$errorMessage = null, string &
return false;
}

$activateTimeFields = ['activation_time','activate_time','activation-time', 'activate-time'];
$activateTimeFields = ['activate_time', 'activation_time', 'activate-time', 'activation-time'];
$deactivateTimeFields = preg_filter('/^/', 'de', $activateTimeFields);
$startTimeFields = ['start_time', 'start-time'];
$requiredFields = [$startTimeFields, ['name', 'formal_name'], ['id', 'short_name', 'short-name'], 'duration'];
Expand Down
30 changes: 15 additions & 15 deletions webapp/tests/Unit/Controller/API/ContestControllerAdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testAddYaml(): void
id: practice
formal_name: NWERC 2020 Practice Session
name: practice
activation_time: '2021-03-27T09:00:00+00:00'
activate_time: '2021-03-27T09:00:00+00:00'
start_time: '2021-03-27T09:00:00+00:00'
end_time: '2021-03-27T11:00:00+00:00'
duration: 2:00:00.000
Expand Down Expand Up @@ -244,9 +244,9 @@ public function provideChangeTimes(): Generator
/**
* @dataProvider provideNewContest
*/
public function testActivationTimeContestYaml(
string $activationTime, string $startTime, ?string $deactivationTime,
bool $setActivation, bool $setDeactivation
public function testActivateTimeContestYaml(
string $activateTime, string $startTime, ?string $deactivateTime,
bool $setActivate, bool $setDeactivate
): void {
$yaml = <<<EOF
duration: 2:00:00
Expand All @@ -262,11 +262,11 @@ public function testActivationTimeContestYaml(
id: anothereruption
EOF;

if ($setActivation) {
$yaml = "activation_time: ".$activationTime."\n".$yaml;
if ($setActivate) {
$yaml = "activate_time: ".$activateTime."\n".$yaml;
}
if ($setDeactivation) {
$yaml = "deactivation_time: ".$deactivationTime."\n".$yaml;
if ($setDeactivate) {
$yaml = "deactivate_time: ".$deactivateTime."\n".$yaml;
}
$url = $this->helperGetEndpointURL($this->apiEndpoint);
$tempYamlFile = tempnam(sys_get_temp_dir(), "/contest-yaml-");
Expand All @@ -278,16 +278,16 @@ public function testActivationTimeContestYaml(

$now = Utils::now();
$nowTime = Utils::printtime($now, 'Y-m-d H:i:s');
$activation = Utils::toEpochFloat($activationTime);
$activate = Utils::toEpochFloat($activateTime);
$start = Utils::toEpochFloat($startTime);

self::assertIsString($cid);
self::assertSame('New Contest to check Activation', $this->getContest($cid)->getName());
self::assertSame($start, $this->getContest($cid)->getStarttime());

if ($setActivation) {
self::assertSame($activationTime, Utils::printtime($this->getContest($cid)->getActivatetime(), 'Y-m-d H:i:s'));
self::assertSame($activation, $this->getContest($cid)->getActivatetime());
if ($setActivate) {
self::assertSame($activateTime, Utils::printtime($this->getContest($cid)->getActivatetime(), 'Y-m-d H:i:s'));
self::assertSame($activate, $this->getContest($cid)->getActivatetime());
} else {
// Contest uploaded starts in the past
if (Utils::printtime(Utils::now(), 'Y-m-d H:i:s')>=$startTime) {
Expand All @@ -296,8 +296,8 @@ public function testActivationTimeContestYaml(
self::assertTrue($this->getContest($cid)->getActivatetime() <= $now);
}
}
if ($deactivationTime) {
self::assertSame($deactivationTime, Utils::printtime($this->getContest($cid)->getDeactivatetime(), 'Y-m-d H:i:s'));
if ($deactivateTime) {
self::assertSame($deactivateTime, Utils::printtime($this->getContest($cid)->getDeactivatetime(), 'Y-m-d H:i:s'));
} else {
self::assertNull($this->getContest($cid)->getDeactivatetime());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function provideContestYamlContents(): Generator
end_time: '{$year}-01-01T13:00:00+00:00'
duration: '5:00:00.000'
penalty_time: 20
activation_time: '{$pastYear}-01-01T08:00:00+00:00'
activate_time: '{$pastYear}-01-01T08:00:00+00:00'
scoreboard_freeze_time: '{$year}-01-01T12:00:00+00:00'
scoreboard_freeze_duration: '1:00:00'
problems:
Expand Down