fix: problem order in contest
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Baoshuo Ren 2022-09-29 10:16:38 +08:00
parent 2eb02d776d
commit 4d002d776e
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -108,7 +108,8 @@ function queryContestProblemRank($contest, $problem) {
if (!DB::selectFirst("select * from contests_problems where contest_id = {$contest['id']} and problem_id = {$problem['id']}")) { if (!DB::selectFirst("select * from contests_problems where contest_id = {$contest['id']} and problem_id = {$problem['id']}")) {
return null; return null;
} }
return DB::selectCount("select count(*) from contests_problems where contest_id = {$contest['id']} and problem_id <= {$problem['id']}"); $contest_problems = DB::selectAll("select problem_id from contests_problems where contest_id = {$contest['id']} order by dfn, problem_id");
return array_search(array('problem_id' => $problem['id']), $contest_problems) + 1;
} }
function querySubmission($id) { function querySubmission($id) {
return DB::selectFirst("select * from submissions where id = $id", MYSQLI_ASSOC); return DB::selectFirst("select * from submissions where id = $id", MYSQLI_ASSOC);