fix(web/contest/after_contest_standings): only fetch data of contestants who has participated in the contest
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-11-06 16:39:55 +08:00
parent 079c405277
commit ba267c15e1
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 10 additions and 3 deletions

View File

@ -153,6 +153,13 @@ function queryOIorIOIContestSubmissionData($contest, $problems, $prob_pos, $conf
"select id, submit_time, submitter, problem_id, score from submissions", "select id, submit_time, submitter, problem_id, score from submissions",
"where", [ "where", [
["problem_id", "in", DB::rawtuple($problems)], ["problem_id", "in", DB::rawtuple($problems)],
["submitter", "in", DB::rawbracket([
"select username from contests_registrants",
"where", [
"contest_id" => $contest['id'],
"has_participated" => 1,
],
])],
], "order by score", ], "order by score",
], DB::NUM); ], DB::NUM);
} else { } else {

View File

@ -15,8 +15,8 @@
var person = score[key]; var person = score[key];
if (person[i] === undefined) return; if (person[i] === undefined) return;
if (person[i][0] === 100 && (first_accepted[i] === undefined || first_accepted[i][1] > person[i][2])) { if (person[i][0] === 100 && (!first_accepted[i] || first_accepted[i] > person[i][2])) {
first_accepted[i] = [person[i][1], person[i][2]]; first_accepted[i] = person[i][2];
} }
}); });
} }
@ -40,7 +40,7 @@
for (var i = 0; i < problems.length; i++) { for (var i = 0; i < problems.length; i++) {
col = score[row[2][0]][i]; col = score[row[2][0]][i];
if (col != undefined) { if (col != undefined) {
col_tr += first_accepted[i] !== undefined && col[2] === first_accepted[i][1] ? '<td class="table-success"' : '<td>'; col_tr += col[2] === first_accepted[i] ? '<td class="table-success">' : '<td>';
col_tr += '<div>'; col_tr += '<div>';
if (col[2]) col_tr += '<a href="/submission/' + col[2] + '" class="uoj-score" style="color:' + getColOfScore(col[0]) + '">' + col[0] + '</a>'; if (col[2]) col_tr += '<a href="/submission/' + col[2] + '" class="uoj-score" style="color:' + getColOfScore(col[0]) + '">' + col[0] + '</a>';