fix: assignCond in queryMinorSubmissionToJudge
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-02-17 13:57:26 +08:00
parent 1f11278815
commit e0cc425031
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -150,7 +150,7 @@ $problem_ban_list = array_map(fn ($x) => $x['id'], DB::selectAll([
])); ]));
if ($problem_ban_list) { if ($problem_ban_list) {
$assignCond[] = ["problem_id", "not in", DB::rawtuple($problem_ban_list)]; $assignCond[] = ["submissions.problem_id", "not in", DB::rawtuple($problem_ban_list)];
} }
if ($_POST['judger_name'] == "remote_judger") { if ($_POST['judger_name'] == "remote_judger") {
@ -170,7 +170,7 @@ if ($_POST['judger_name'] == "remote_judger") {
} }
if ($problem_ban_list) { if ($problem_ban_list) {
$assignCond[] = ["problem_id", "not in", DB::rawtuple($problem_ban_list)]; $assignCond[] = ["submissions.problem_id", "not in", DB::rawtuple($problem_ban_list)];
} }
$submission = null; $submission = null;
@ -180,8 +180,8 @@ function querySubmissionToJudge($status, $set_q) {
for ($times = 0; $times < 10; $times++) { for ($times = 0; $times < 10; $times++) {
$submission = DB::selectFirst([ $submission = DB::selectFirst([
"select id from submissions", "select submissions.id from submissions",
"where", array_merge(["status" => $status], $assignCond), "where", array_merge(["submissions.status" => $status], $assignCond),
"order by id limit 1" "order by id limit 1"
]); ]);
if (!$submission) { if (!$submission) {
@ -218,8 +218,9 @@ function queryMinorSubmissionToJudge($status, $set_q) {
for ($times = 0; $times < 10; $times++) { for ($times = 0; $times < 10; $times++) {
$submission = null; $submission = null;
$his = DB::selectFirst([ $his = DB::selectFirst([
"select id, submission_id from submissions_history", "select submissions_history.id, submissions_history.submission_id from submissions_history",
"where", ["status" => $status, "major" => 0], // $assignCond is removed!!! fix this bug in the future! "inner join submissions on submissions.id = submissions_history.submission_id",
"where", array_merge(["submissions_history.status" => $status, "submissions_history.major" => 0], $assignCond),
"order by id limit 1" "order by id limit 1"
]); ]);
if (!$his) { if (!$his) {
@ -266,8 +267,8 @@ function queryCustomTestSubmissionToJudge() {
while (true) { while (true) {
$submission = DB::selectFirst([ $submission = DB::selectFirst([
"select id, problem_id, content from custom_test_submissions", "select id, problem_id, content from custom_test_submissions as submissions",
"where", array_merge(["judge_time" => null], $assignCond), "where", array_merge(["submissions.judge_time" => null], $assignCond),
"order by id limit 1" "order by id limit 1"
]); ]);
if (!$submission) { if (!$submission) {
@ -279,10 +280,10 @@ function queryCustomTestSubmissionToJudge() {
"update custom_test_submissions", "update custom_test_submissions",
"set", [ "set", [
"judge_time" => DB::now(), "judge_time" => DB::now(),
"status" => 'Judging' "status" => 'Judging',
], "where", [ ], "where", [
"id" => $submission['id'], "id" => $submission['id'],
"judge_time" => null "judge_time" => null,
] ]
]); ]);
if (DB::affected_rows() == 1) { if (DB::affected_rows() == 1) {
@ -306,8 +307,9 @@ function queryHackToJudge() {
} }
$hack = DB::selectFirst([ $hack = DB::selectFirst([
"select id, submission_id, input, input_type from hacks", "select hacks.id, hacks.submission_id, hacks.input, hacks.input_type from hacks",
"where", array_merge(["judge_time" => null], $assignCond), "inner join submissions on submissions.id = hacks.submission_id",
"where", array_merge(["hacks.judge_time" => null], $assignCond),
"order by id limit 1" "order by id limit 1"
]); ]);
if (!$hack) { if (!$hack) {