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(
'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;
<?= getClickZanBlock('C', $contest['id'], $contest['zan']) ?>
</div>
<div class="row">
<?php if ($cur_tab == 'standings'): ?>
<?php if ($cur_tab == 'standings' || $cur_tab == 'after_contest_standings'): ?>
<div class="col-sm-12">
<?php else: ?>
<div class="col-sm-9">
@ -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;
</div>
</div>
<?php if ($cur_tab == 'standings'): ?>
<?php if ($cur_tab == 'standings' || $cur_tab == 'after_contest_standings'): ?>
<div class="col-sm-12">
<hr />
</div>
@ -487,7 +493,7 @@ EOD;
echoContestFinished();
}
?>
<?php if ($cur_tab == 'standings'): ?>
<?php if ($cur_tab == 'standings' || $cur_tab == 'after_contest_standings'): ?>
</div>
<div class="col-sm-3">
<?php endif ?>

View File

@ -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']}");

View File

@ -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',

View File

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

View File

@ -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');