From 75cb0f3749543c27a01eac3e71a6d6552cbc029a Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 6 Nov 2022 15:57:38 +0800 Subject: [PATCH] feat(web/contest/standings): first accepted --- web/app/views/contest-standings.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/web/app/views/contest-standings.php b/web/app/views/contest-standings.php index 2af3ff8..b780867 100644 --- a/web/app/views/contest-standings.php +++ b/web/app/views/contest-standings.php @@ -7,8 +7,20 @@ var score = ; var problems = ; var standings_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('') + '', function(row) { - var col_tr = row[0] === problems.length * 100 ? '' : ''; + var col_tr = ''; col_tr += '' + row[3] + ''; col_tr += '' + getUserLink(row[2][0], row[2][1]) + ''; col_tr += '' + '
' + row[0] + '
' + '
' + getPenaltyTimeStr(row[1]) + '
'; for (var i = 0; i < problems.length; i++) { col = score[row[2][0]][i]; if (col != undefined) { - col_tr += col[0] === 100 ? ''; + col_tr += first_accepted[i] !== undefined && col[2] === first_accepted[i][1] ? ''; col_tr += '
'; if (col[2]) col_tr += '' + col[0] + '';