feat(web/contest): after contest standings

This commit is contained in:
Baoshuo Ren 2022-04-13 16:23:24 +08:00
parent 6bd4d26a4e
commit 1ce854744f
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
5 changed files with 17 additions and 6 deletions

View File

@ -43,6 +43,10 @@
'standings' => array( 'standings' => array(
'name' => UOJLocale::get('contests::contest standings'), 'name' => UOJLocale::get('contests::contest standings'),
'url' => "/contest/{$contest['id']}/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; global $contest;
$contest_data = queryContestData($contest); $contest_data = queryContestData($contest, array(), $is_after_contest_query);
calcStandings($contest, $contest_data, $score, $standings); calcStandings($contest, $contest_data, $score, $standings);
uojIncludeView('contest-standings', [ uojIncludeView('contest-standings', [
@ -450,7 +454,7 @@ EOD;
<?= getClickZanBlock('C', $contest['id'], $contest['zan']) ?> <?= getClickZanBlock('C', $contest['id'], $contest['zan']) ?>
</div> </div>
<div class="row"> <div class="row">
<?php if ($cur_tab == 'standings'): ?> <?php if ($cur_tab == 'standings' || $cur_tab == 'after_contest_standings'): ?>
<div class="col-sm-12"> <div class="col-sm-12">
<?php else: ?> <?php else: ?>
<div class="col-sm-9"> <div class="col-sm-9">
@ -464,6 +468,8 @@ EOD;
echoMySubmissions(); echoMySubmissions();
} elseif ($cur_tab == 'standings') { } elseif ($cur_tab == 'standings') {
echoStandings(); echoStandings();
} elseif ($cur_tab == 'after_contest_standings') {
echoStandings(true);
} elseif ($cur_tab == 'backstage') { } elseif ($cur_tab == 'backstage') {
echoBackstage(); echoBackstage();
} }
@ -471,7 +477,7 @@ EOD;
</div> </div>
</div> </div>
<?php if ($cur_tab == 'standings'): ?> <?php if ($cur_tab == 'standings' || $cur_tab == 'after_contest_standings'): ?>
<div class="col-sm-12"> <div class="col-sm-12">
<hr /> <hr />
</div> </div>
@ -487,7 +493,7 @@ EOD;
echoContestFinished(); echoContestFinished();
} }
?> ?>
<?php if ($cur_tab == 'standings'): ?> <?php if ($cur_tab == 'standings' || $cur_tab == 'after_contest_standings'): ?>
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">
<?php endif ?> <?php endif ?>

View File

@ -38,7 +38,7 @@ function updateContestPlayerNum($contest) {
// problems: pos => id // problems: pos => id
// data : id, submit_time, submitter, problem_pos, score // data : id, submit_time, submitter, problem_pos, score
// people : username // people : username
function queryContestData($contest, $config = array()) { function queryContestData($contest, $config = array(), $is_after_contest_query = false) {
mergeConfig($config, [ mergeConfig($config, [
'pre_final' => false 'pre_final' => false
]); ]);
@ -69,6 +69,8 @@ function queryContestData($contest, $config = array()) {
if ($contest['cur_progress'] < CONTEST_FINISHED) { if ($contest['cur_progress'] < CONTEST_FINISHED) {
$result = DB::query("select id, submit_time, submitter, problem_id, score from submissions" $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"); ." 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 { } else {
$result = DB::query("select submission_id, date_add('{$contest['start_time_str']}', interval penalty second)," $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']}"); ." submitter, problem_id, score from contests_submissions where contest_id = {$contest['id']}");

View File

@ -18,6 +18,7 @@ return [
'contest dashboard' => 'Dashboard', 'contest dashboard' => 'Dashboard',
'contest submissions' => 'Submissions', 'contest submissions' => 'Submissions',
'contest standings' => 'Standings', 'contest standings' => 'Standings',
'after contest standings' => 'After contest standings',
'contest backstage' => 'Backstage', 'contest backstage' => 'Backstage',
'contest notice' => 'Notice', 'contest notice' => 'Notice',
'show all submissions' => 'Show all submissions', 'show all submissions' => 'Show all submissions',

View File

@ -18,6 +18,7 @@ return [
'contest dashboard' => '比赛主页', 'contest dashboard' => '比赛主页',
'contest submissions' => '提交记录', 'contest submissions' => '提交记录',
'contest standings' => '排行榜', 'contest standings' => '排行榜',
'after contest standings' => '赛后排行榜',
'contest backstage' => '大后台', 'contest backstage' => '大后台',
'contest notice' => '比赛通知', 'contest notice' => '比赛通知',
'show all submissions' => '显示所有提交', 'show all submissions' => '显示所有提交',

View File

@ -27,6 +27,7 @@ Route::group([
Route::any('/contest/{id}/manage', '/contest_manage.php'); Route::any('/contest/{id}/manage', '/contest_manage.php');
Route::any('/contest/{id}/submissions', '/contest_inside.php?tab=submissions'); Route::any('/contest/{id}/submissions', '/contest_inside.php?tab=submissions');
Route::any('/contest/{id}/standings', '/contest_inside.php?tab=standings'); 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/{id}/backstage', '/contest_inside.php?tab=backstage');
Route::any('/contest/{contest_id}/problem/{id}', '/problem.php'); Route::any('/contest/{contest_id}/problem/{id}', '/problem.php');
Route::any('/contest/{contest_id}/problem/{id}/statistics', '/problem_statistics.php'); Route::any('/contest/{contest_id}/problem/{id}/statistics', '/problem_statistics.php');