feat(contest): final test for ioi contests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-02-16 06:36:14 +08:00
parent 7948c1bb2a
commit 32efcd3e64
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 5 additions and 32 deletions

View File

@ -5,33 +5,6 @@ define("CONTEST_PENDING_FINAL_TEST", 2);
define("CONTEST_TESTING", 10); define("CONTEST_TESTING", 10);
define("CONTEST_FINISHED", 20); define("CONTEST_FINISHED", 20);
function genMoreContestInfo(&$contest) {
$contest['start_time_str'] = $contest['start_time'];
$contest['start_time'] = new DateTime($contest['start_time']);
$contest['end_time'] = clone $contest['start_time'];
$contest['end_time']->add(new DateInterval("PT${contest['last_min']}M"));
$contest['end_time_str'] = $contest['end_time']->format('Y-m-d H:i:s');
if ($contest['status'] == 'unfinished') {
if (UOJTime::$time_now < $contest['start_time']) {
$contest['cur_progress'] = CONTEST_NOT_STARTED;
} elseif (UOJTime::$time_now < $contest['end_time']) {
$contest['cur_progress'] = CONTEST_IN_PROGRESS;
} else {
$contest['cur_progress'] = CONTEST_PENDING_FINAL_TEST;
}
} elseif ($contest['status'] == 'testing') {
$contest['cur_progress'] = CONTEST_TESTING;
} elseif ($contest['status'] == 'finished') {
$contest['cur_progress'] = CONTEST_FINISHED;
}
$contest['extra_config'] = json_decode($contest['extra_config'], true);
if (!isset($contest['extra_config']['standings_version'])) {
$contest['extra_config']['standings_version'] = 2;
}
}
function updateContestPlayerNum($contest) { function updateContestPlayerNum($contest) {
DB::update([ DB::update([
"update contests", "update contests",

View File

@ -132,11 +132,11 @@ class UOJContest {
} elseif (UOJTime::$time_now < $this->info['end_time']) { } elseif (UOJTime::$time_now < $this->info['end_time']) {
$this->info['cur_progress'] = CONTEST_IN_PROGRESS; $this->info['cur_progress'] = CONTEST_IN_PROGRESS;
} else { } else {
if ($this->info['extra_config']['basic_rule'] == 'IOI') { // if ($this->info['extra_config']['basic_rule'] == 'IOI') {
$this->info['cur_progress'] = CONTEST_TESTING; // $this->info['cur_progress'] = CONTEST_TESTING;
} else { // } else {
$this->info['cur_progress'] = CONTEST_PENDING_FINAL_TEST; $this->info['cur_progress'] = CONTEST_PENDING_FINAL_TEST;
} // }
} }
} elseif ($this->info['status'] == 'testing') { } elseif ($this->info['status'] == 'testing') {
$this->info['cur_progress'] = CONTEST_TESTING; $this->info['cur_progress'] = CONTEST_TESTING;