mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 00:28:42 +00:00
fix: bb5de2a00e
This commit is contained in:
parent
46f6923d97
commit
419be8ab49
@ -269,6 +269,7 @@ UNLOCK TABLES;
|
||||
CREATE TABLE `contests_problems` (
|
||||
`problem_id` int(11) NOT NULL,
|
||||
`contest_id` int(11) NOT NULL,
|
||||
`dfn` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`problem_id`,`contest_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
@ -67,6 +67,7 @@
|
||||
},
|
||||
function($type, $username) {
|
||||
global $contest;
|
||||
|
||||
if ($type == '+') {
|
||||
DB::query("insert into contests_permissions (contest_id, username) values (${contest['id']}, '$username')");
|
||||
} elseif ($type == '-') {
|
||||
@ -99,7 +100,8 @@
|
||||
$problem_id = $matches[1];
|
||||
|
||||
if ($type == '+') {
|
||||
DB::insert("insert into contests_problems (contest_id, problem_id) values ({$contest['id']}, '$problem_id')");
|
||||
$dfn = DB::selectFirst("select max(dfn) from contests_problems where contest_id = {$contest['id']}")['max(dfn)'] + 1;
|
||||
DB::insert("insert into contests_problems (contest_id, problem_id, dfn) values ({$contest['id']}, '$problem_id', $dfn)");
|
||||
} elseif ($type == '-') {
|
||||
DB::delete("delete from contests_problems where contest_id = {$contest['id']} and problem_id = '$problem_id'");
|
||||
}
|
||||
@ -216,7 +218,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$result = DB::query("select problem_id from contests_problems where contest_id = ${contest['id']} order by dfn asc");
|
||||
$result = DB::query("select problem_id from contests_problems where contest_id = ${contest['id']} order by dfn, problem_id");
|
||||
while ($row = DB::fetch($result, MYSQLI_ASSOC)) {
|
||||
$problem = queryProblemBrief($row['problem_id']);
|
||||
$problem_config_str = isset($contest['extra_config']["problem_{$problem['id']}"]) ? $contest['extra_config']["problem_{$problem['id']}"] : 'sample';
|
||||
|
@ -46,7 +46,7 @@ function queryContestData($contest, $config = array(), $is_after_contest_query =
|
||||
$problems = [];
|
||||
$prob_pos = [];
|
||||
$n_problems = 0;
|
||||
$result = DB::query("select problem_id from contests_problems where contest_id = {$contest['id']} order by dfn");
|
||||
$result = DB::query("select problem_id from contests_problems where contest_id = {$contest['id']} order by dfn, problem_id");
|
||||
while ($row = DB::fetch($result, MYSQLI_NUM)) {
|
||||
$prob_pos[$problems[] = (int)$row[0]] = $n_problems++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user