diff --git a/web/app/controllers/contest_inside.php b/web/app/controllers/contest_inside.php index c023195..e65f3b6 100644 --- a/web/app/controllers/contest_inside.php +++ b/web/app/controllers/contest_inside.php @@ -453,7 +453,13 @@ function echoMySubmissions() { function echoStandings($is_after_contest_query = false) { global $contest; - uojIncludeView('contest-standings', ['contest' => $contest] + UOJContest::cur()->queryResult(['after_contest' => $is_after_contest_query])); + + uojIncludeView('contest-standings', [ + 'contest' => $contest, + 'after_contest' => $is_after_contest_query, + ] + UOJContest::cur()->queryResult([ + 'after_contest' => $is_after_contest_query, + ])); } function echoSelfReviews() { diff --git a/web/app/libs/uoj-contest-lib.php b/web/app/libs/uoj-contest-lib.php index 1422394..d8f129a 100644 --- a/web/app/libs/uoj-contest-lib.php +++ b/web/app/libs/uoj-contest-lib.php @@ -78,7 +78,7 @@ function queryContestData($contest, $config = []) { $prob_pos[$problems[] = (int)$row[0]] = $n_problems++; } - if ($contest['extra_config']['basic_rule'] == 'OI' || $contest['extra_config']['basic_rule'] == 'IOI') { + if ($contest['extra_config']['basic_rule'] == 'OI' || $contest['extra_config']['basic_rule'] == 'IOI' || $config['after_contest']) { $data = queryOIorIOIContestSubmissionData($contest, $problems, $prob_pos, $config); } elseif ($contest['extra_config']['basic_rule'] == 'ACM') { $data = queryACMContestSubmissionData($contest, $problems, $prob_pos, $config); @@ -290,6 +290,16 @@ function calcStandings($contest, $contest_data, &$score, &$standings, $cfg = []) } $score[$sub[2]][$sub[3]] = array($sub[4], $penalty, $sub[0]); } + } else if ($contest['extra_config']['basic_rule'] === 'IOI' || $cfg['after_contest']) { + foreach ($contest_data['data'] as $sub) { + $penalty = (new DateTime($sub[1]))->getTimestamp() - $contest['start_time']->getTimestamp(); + if ($sub[4] == 0) { + $penalty = 0; + } + if (!isset($score[$sub[2]][$sub[3]]) || $score[$sub[2]][$sub[3]][0] < $sub[4]) { + $score[$sub[2]][$sub[3]] = array($sub[4], $penalty, $sub[0]); + } + } } else if ($contest['extra_config']['basic_rule'] === 'ACM') { // sub: id, submit_time, submitter, problem_pos, score // id, submit_time (plus penalty), submitter, problem_pos, score, cnt, n_failures @@ -388,16 +398,6 @@ function calcStandings($contest, $contest_data, &$score, &$standings, $cfg = []) } } } - } else if ($contest['extra_config']['basic_rule'] === 'IOI') { - foreach ($contest_data['data'] as $sub) { - $penalty = (new DateTime($sub[1]))->getTimestamp() - $contest['start_time']->getTimestamp(); - if ($sub[4] == 0) { - $penalty = 0; - } - if (!isset($score[$sub[2]][$sub[3]]) || $score[$sub[2]][$sub[3]][0] < $sub[4]) { - $score[$sub[2]][$sub[3]] = array($sub[4], $penalty, $sub[0]); - } - } } // standings: rank => score, penalty, [username, realname, null|array, null|color], virtual_rank, ?review diff --git a/web/app/models/UOJContest.php b/web/app/models/UOJContest.php index 41cb363..f50562d 100644 --- a/web/app/models/UOJContest.php +++ b/web/app/models/UOJContest.php @@ -339,10 +339,11 @@ class UOJContest { public function queryResult($cfg = []) { $contest_data = queryContestData($this->info, $cfg); calcStandings($this->info, $contest_data, $score, $standings, $cfg); + return [ 'standings' => $standings, 'score' => $score, - 'contest_data' => $contest_data + 'contest_data' => $contest_data, ]; } diff --git a/web/app/views/contest-standings.php b/web/app/views/contest-standings.php index 84d52c2..098c3f0 100644 --- a/web/app/views/contest-standings.php +++ b/web/app/views/contest-standings.php @@ -16,6 +16,7 @@ var problems = = json_encode($contest_data['problems']) ?>; var standings_config = = json_encode(isset($standings_config) ? $standings_config : ['_config' => true]) ?>; var myname = = json_encode(Auth::id()) ?>; + var after_contest = = json_encode(isset($after_contest) && $after_contest) ?>; var first_accepted = {}; $(document).ready(showStandings()); diff --git a/web/js/uoj.js b/web/js/uoj.js index 8efaa1d..edb5ebf 100644 --- a/web/js/uoj.js +++ b/web/js/uoj.js @@ -1876,7 +1876,7 @@ function setACMStandingsTD(td, row, i, meta) { // standings function showStandings() { - if (contest_rule == 'OI' || contest_rule == 'IOI') { + if (contest_rule == 'OI' || contest_rule == 'IOI' || after_contest) { $("#standings").long_table( standings, 1, @@ -1897,17 +1897,19 @@ function showStandings() { } col_tr += '