mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 11:38:42 +00:00
fix: 3ffa996631
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3ffa996631
commit
a894939f75
@ -453,7 +453,13 @@ function echoMySubmissions() {
|
|||||||
|
|
||||||
function echoStandings($is_after_contest_query = false) {
|
function echoStandings($is_after_contest_query = false) {
|
||||||
global $contest;
|
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() {
|
function echoSelfReviews() {
|
||||||
|
@ -78,7 +78,7 @@ function queryContestData($contest, $config = []) {
|
|||||||
$prob_pos[$problems[] = (int)$row[0]] = $n_problems++;
|
$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);
|
$data = queryOIorIOIContestSubmissionData($contest, $problems, $prob_pos, $config);
|
||||||
} elseif ($contest['extra_config']['basic_rule'] == 'ACM') {
|
} elseif ($contest['extra_config']['basic_rule'] == 'ACM') {
|
||||||
$data = queryACMContestSubmissionData($contest, $problems, $prob_pos, $config);
|
$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]);
|
$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') {
|
} else if ($contest['extra_config']['basic_rule'] === 'ACM') {
|
||||||
// sub: id, submit_time, submitter, problem_pos, score
|
// sub: id, submit_time, submitter, problem_pos, score
|
||||||
// id, submit_time (plus penalty), submitter, problem_pos, score, cnt, n_failures
|
// 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
|
// standings: rank => score, penalty, [username, realname, null|array, null|color], virtual_rank, ?review
|
||||||
|
@ -339,10 +339,11 @@ class UOJContest {
|
|||||||
public function queryResult($cfg = []) {
|
public function queryResult($cfg = []) {
|
||||||
$contest_data = queryContestData($this->info, $cfg);
|
$contest_data = queryContestData($this->info, $cfg);
|
||||||
calcStandings($this->info, $contest_data, $score, $standings, $cfg);
|
calcStandings($this->info, $contest_data, $score, $standings, $cfg);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'standings' => $standings,
|
'standings' => $standings,
|
||||||
'score' => $score,
|
'score' => $score,
|
||||||
'contest_data' => $contest_data
|
'contest_data' => $contest_data,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
var problems = <?= json_encode($contest_data['problems']) ?>;
|
var problems = <?= json_encode($contest_data['problems']) ?>;
|
||||||
var standings_config = <?= json_encode(isset($standings_config) ? $standings_config : ['_config' => true]) ?>;
|
var standings_config = <?= json_encode(isset($standings_config) ? $standings_config : ['_config' => true]) ?>;
|
||||||
var myname = <?= json_encode(Auth::id()) ?>;
|
var myname = <?= json_encode(Auth::id()) ?>;
|
||||||
|
var after_contest = <?= json_encode(isset($after_contest) && $after_contest) ?>;
|
||||||
var first_accepted = {};
|
var first_accepted = {};
|
||||||
|
|
||||||
$(document).ready(showStandings());
|
$(document).ready(showStandings());
|
||||||
|
@ -1876,7 +1876,7 @@ function setACMStandingsTD(td, row, i, meta) {
|
|||||||
|
|
||||||
// standings
|
// standings
|
||||||
function showStandings() {
|
function showStandings() {
|
||||||
if (contest_rule == 'OI' || contest_rule == 'IOI') {
|
if (contest_rule == 'OI' || contest_rule == 'IOI' || after_contest) {
|
||||||
$("#standings").long_table(
|
$("#standings").long_table(
|
||||||
standings,
|
standings,
|
||||||
1,
|
1,
|
||||||
@ -1897,17 +1897,19 @@ function showStandings() {
|
|||||||
}
|
}
|
||||||
col_tr += '<td>' + row[3] + '</td>';
|
col_tr += '<td>' + row[3] + '</td>';
|
||||||
col_tr += '<td>' + getUserLink(row[2][0], row[2][1], row[2][3]) + '</td>';
|
col_tr += '<td>' + getUserLink(row[2][0], row[2][1], row[2][3]) + '</td>';
|
||||||
col_tr += '<td>' + '<div><span class="uoj-score" data-max="' + problems.length * 100 + '" style="color:' + getColOfScore(row[0] / problems.length) + '">' + row[0] + '</span></div>' + '<div class="small">' + getPenaltyTimeStr(row[1]) + '</div></td>';
|
col_tr += '<td>' + '<div><span class="uoj-score" data-max="' + problems.length * 100 + '" style="color:' + getColOfScore(row[0] / problems.length) + '">' + row[0] + '</span></div>' + (after_contest ? '' : '<div class="small">' + getPenaltyTimeStr(row[1]) + '</div>') + '</td>';
|
||||||
for (var i = 0; i < problems.length; i++) {
|
for (var i = 0; i < problems.length; i++) {
|
||||||
col_tr += '<td>';
|
col_tr += '<td>';
|
||||||
col = score[row[2][0]][i];
|
col = score[row[2][0]][i];
|
||||||
if (col != undefined) {
|
if (col != undefined) {
|
||||||
col_tr += '<div><a href="/submission/' + col[2] + '" class="uoj-score" style="color:' + getColOfScore(col[0]) + '">' + col[0] + '</a></div>';
|
col_tr += '<div><a href="/submission/' + col[2] + '" class="uoj-score" style="color:' + getColOfScore(col[0]) + '">' + col[0] + '</a></div>';
|
||||||
if (standings_version < 2) {
|
if (!after_contest) {
|
||||||
col_tr += '<div class="small">' + getPenaltyTimeStr(col[1]) + '</div>';
|
if (standings_version < 2) {
|
||||||
} else {
|
|
||||||
if (col[0] > 0) {
|
|
||||||
col_tr += '<div class="small">' + getPenaltyTimeStr(col[1]) + '</div>';
|
col_tr += '<div class="small">' + getPenaltyTimeStr(col[1]) + '</div>';
|
||||||
|
} else {
|
||||||
|
if (col[0] > 0) {
|
||||||
|
col_tr += '<div class="small">' + getPenaltyTimeStr(col[1]) + '</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user