1
1
mirror of https://github.com/renbaoshuo/S2OJ.git synced 2025-03-26 08:07:02 +00:00

fix: problem order in contest

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

@ -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']}")) {
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) {
return DB::selectFirst("select * from submissions where id = $id", MYSQLI_ASSOC);