From 1ce854744fd91b3b1299a6d11693bd9e6c025917 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Wed, 13 Apr 2022 16:23:24 +0800 Subject: [PATCH] feat(web/contest): after contest standings --- web/app/controllers/contest_inside.php | 16 +++++++++++----- web/app/libs/uoj-contest-lib.php | 4 +++- web/app/locale/contests/en.php | 1 + web/app/locale/contests/zh-cn.php | 1 + web/app/route.php | 1 + 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/web/app/controllers/contest_inside.php b/web/app/controllers/contest_inside.php index 3be72ba..bccdbd6 100644 --- a/web/app/controllers/contest_inside.php +++ b/web/app/controllers/contest_inside.php @@ -43,6 +43,10 @@ 'standings' => array( 'name' => UOJLocale::get('contests::contest standings'), 'url' => "/contest/{$contest['id']}/standings" + ), + 'after_contest_standings' => array( + 'name' => UOJLocale::get('contests::after contest standings'), + 'url' => "/contest/{$contest['id']}/after_contest_standings" ) ); @@ -374,10 +378,10 @@ EOD; } } - function echoStandings() { + function echoStandings($is_after_contest_query = false) { global $contest; - $contest_data = queryContestData($contest); + $contest_data = queryContestData($contest, array(), $is_after_contest_query); calcStandings($contest, $contest_data, $score, $standings); uojIncludeView('contest-standings', [ @@ -450,7 +454,7 @@ EOD;
- +
@@ -464,6 +468,8 @@ EOD; echoMySubmissions(); } elseif ($cur_tab == 'standings') { echoStandings(); + } elseif ($cur_tab == 'after_contest_standings') { + echoStandings(true); } elseif ($cur_tab == 'backstage') { echoBackstage(); } @@ -471,7 +477,7 @@ EOD;
- +

@@ -487,7 +493,7 @@ EOD; echoContestFinished(); } ?> - +
diff --git a/web/app/libs/uoj-contest-lib.php b/web/app/libs/uoj-contest-lib.php index 27cebfb..d838abb 100644 --- a/web/app/libs/uoj-contest-lib.php +++ b/web/app/libs/uoj-contest-lib.php @@ -38,7 +38,7 @@ function updateContestPlayerNum($contest) { // problems: pos => id // data : id, submit_time, submitter, problem_pos, score // people : username -function queryContestData($contest, $config = array()) { +function queryContestData($contest, $config = array(), $is_after_contest_query = false) { mergeConfig($config, [ 'pre_final' => false ]); @@ -69,6 +69,8 @@ function queryContestData($contest, $config = array()) { if ($contest['cur_progress'] < CONTEST_FINISHED) { $result = DB::query("select id, submit_time, submitter, problem_id, score from submissions" ." where contest_id = {$contest['id']} and score is not null order by id"); + } elseif ($is_after_contest_query == true) { + $result = DB::query("select id, submit_time, submitter, problem_id, score from submissions order by score"); } else { $result = DB::query("select submission_id, date_add('{$contest['start_time_str']}', interval penalty second)," ." submitter, problem_id, score from contests_submissions where contest_id = {$contest['id']}"); diff --git a/web/app/locale/contests/en.php b/web/app/locale/contests/en.php index fa006d1..0780dbb 100644 --- a/web/app/locale/contests/en.php +++ b/web/app/locale/contests/en.php @@ -18,6 +18,7 @@ return [ 'contest dashboard' => 'Dashboard', 'contest submissions' => 'Submissions', 'contest standings' => 'Standings', + 'after contest standings' => 'After contest standings', 'contest backstage' => 'Backstage', 'contest notice' => 'Notice', 'show all submissions' => 'Show all submissions', diff --git a/web/app/locale/contests/zh-cn.php b/web/app/locale/contests/zh-cn.php index 1e3d16c..2a74a8c 100644 --- a/web/app/locale/contests/zh-cn.php +++ b/web/app/locale/contests/zh-cn.php @@ -18,6 +18,7 @@ return [ 'contest dashboard' => '比赛主页', 'contest submissions' => '提交记录', 'contest standings' => '排行榜', + 'after contest standings' => '赛后排行榜', 'contest backstage' => '大后台', 'contest notice' => '比赛通知', 'show all submissions' => '显示所有提交', diff --git a/web/app/route.php b/web/app/route.php index 75d2f7f..d045857 100644 --- a/web/app/route.php +++ b/web/app/route.php @@ -27,6 +27,7 @@ Route::group([ Route::any('/contest/{id}/manage', '/contest_manage.php'); Route::any('/contest/{id}/submissions', '/contest_inside.php?tab=submissions'); Route::any('/contest/{id}/standings', '/contest_inside.php?tab=standings'); + Route::any('/contest/{id}/after_contest_standings', '/contest_inside.php?tab=after_contest_standings'); Route::any('/contest/{id}/backstage', '/contest_inside.php?tab=backstage'); Route::any('/contest/{contest_id}/problem/{id}', '/problem.php'); Route::any('/contest/{contest_id}/problem/{id}/statistics', '/problem_statistics.php');