1
0
mirror of https://github.com/renbaoshuo/UOJ-Luogu-RemoteJudge.git synced 2024-11-23 19:38:42 +00:00

fix: disable custom test in remote problem

This commit is contained in:
Baoshuo Ren 2023-03-20 15:18:50 +08:00
parent b8e84f43f1
commit 2889b6df81
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?php
function getProblemCustomTestRequirement($problem) {
$extra_config = json_decode($problem['extra_config'], true);
if ($problem['type'] != 'local') {
return array();
} elseif (isset($extra_config['custom_test_requirement'])) {
return $extra_config['custom_test_requirement'];
} else {
$answer = array(
'name' => 'answer',
'type' => 'source code',
'file_name' => 'answer.code'
);
foreach (getProblemSubmissionRequirement($problem) as $req) {
if ($req['name'] == 'answer' && $req['type'] == 'source code' && isset($req['languages'])) {
$answer['languages'] = $req['languages'];
}
}
return array(
$answer,
array(
'name' => 'input',
'type' => 'text',
'file_name' => 'input.txt'
)
);
}
}

View File

@ -0,0 +1,13 @@
--- UOJ-System/web/app/libs/uoj-utility-lib.php 2022-12-30 09:54:05.452022649 +0800
+++ UOJ-Luogu-RemoteJudge/web/app/libs/uoj-utility-lib.php 2023-03-20 15:17:40.943109445 +0800
@@ -150,7 +150,9 @@
}
function getProblemCustomTestRequirement($problem) {
$extra_config = json_decode($problem['extra_config'], true);
- if (isset($extra_config['custom_test_requirement'])) {
+ if ($problem['type'] != 'local') {
+ return array();
+ } elseif (isset($extra_config['custom_test_requirement'])) {
return $extra_config['custom_test_requirement'];
} else {
$answer = array(