feat(web/contest/standings): first accepted
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-11-06 15:57:38 +08:00
parent c93e5d3c46
commit 75cb0f3749
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -7,8 +7,20 @@
var score = <?= json_encode($score) ?>;
var problems = <?= json_encode($contest_data['problems']) ?>;
var standings_config = <?= json_encode(isset($standings_config) ? $standings_config : ['_config' => true]) ?>;
var first_accepted = {};
$(document).ready(function() {
for (var i = 0; i < problems.length; i++) {
Object.keys(score).forEach(function(key) {
var person = score[key];
if (person[i] === undefined) return;
if (person[i][0] === 100 && (first_accepted[i] === undefined || first_accepted[i][0] === person[i][1] && first_accepted[i][1] > person[i][2])) {
first_accepted[i] = [person[i][1], person[i][2]];
}
});
}
$("#standings").long_table(
standings,
1,
@ -21,14 +33,14 @@
}).join('') +
'</tr>',
function(row) {
var col_tr = row[0] === problems.length * 100 ? '<tr class="table-success">' : '<tr>';
var col_tr = '<tr>';
col_tr += '<td>' + row[3] + '</td>';
col_tr += '<td>' + getUserLink(row[2][0], row[2][1]) + '</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>' + getPenaltyTimeStr(row[1]) + '</div></td>';
for (var i = 0; i < problems.length; i++) {
col = score[row[2][0]][i];
if (col != undefined) {
col_tr += col[0] === 100 ? '<td class="table-success"' : '<td>';
col_tr += first_accepted[i] !== undefined && col[2] === first_accepted[i][1] ? '<td class="table-success"' : '<td>';
col_tr += '<div>';
if (col[2]) col_tr += '<a href="/submission/' + col[2] + '" class="uoj-score" style="color:' + getColOfScore(col[0]) + '">' + col[0] + '</a>';