mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
fps-import: 修复文件为空导致的错误
This commit is contained in:
1 parent
fec85985ef
commit
9d0616f89f
2 files changed
+13
-9
No files matched your search
@@ -70,14 +70,18 @@ class FpsProblemImportHandler extends Handler {
|
|||||||
await problem.addTestdata(domainId, pid, 'config.yaml', Buffer.from(`time: ${config.time}\nmemory: ${config.memory}`));
|
await problem.addTestdata(domainId, pid, 'config.yaml', Buffer.from(`time: ${config.time}\nmemory: ${config.memory}`));
|
||||||
if (p.test_output) {
|
if (p.test_output) {
|
||||||
for (let i = 0; i < p.test_input.length; i++) {
|
for (let i = 0; i < p.test_input.length; i++) {
|
||||||
await problem.addTestdata(
|
const input = typeof p.test_input[i]?._ === 'string'
|
||||||
domainId, pid, `${i + 1}.in`,
|
? p.test_input[i]?._
|
||||||
Buffer.from(p.test_input[i]._ || p.test_input[i]),
|
: typeof p.test_input[i] === 'string'
|
||||||
);
|
? p.test_input[i]
|
||||||
await problem.addTestdata(
|
: '';
|
||||||
domainId, pid, `${i + 1}.out`,
|
const output = typeof p.test_output[i]?._ === 'string'
|
||||||
Buffer.from(p.test_output[i]._ || p.test_output[i]),
|
? p.test_output[i]?._
|
||||||
);
|
: typeof p.test_output[i] === 'string'
|
||||||
|
? p.test_output[i]
|
||||||
|
: '';
|
||||||
|
await problem.addTestdata(domainId, pid, `${i + 1}.in`, Buffer.from(input));
|
||||||
|
await problem.addTestdata(domainId, pid, `${i + 1}.out`, Buffer.from(output));
|
||||||
}
|
}
|
||||||
} else if (p.test_input) {
|
} else if (p.test_input) {
|
||||||
for (let i = 0; i < p.test_input.length / 2; i++) {
|
for (let i = 0; i < p.test_input.length / 2; i++) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/fps-importer",
|
"name": "@hydrooj/fps-importer",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"description": "Import FPS problems",
|
"description": "Import FPS problems",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
Reference in new issue
Block a user