From a03a77bd5209d4d027a7efe3e16787a4b1938d8f Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 5 May 2021 19:08:29 +0800 Subject: [PATCH] fps: support latest format --- packages/fps-importer/handler.ts | 10 ++++++++-- packages/fps-importer/package.json | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/fps-importer/handler.ts b/packages/fps-importer/handler.ts index 1b95918f7..6eb24c078 100644 --- a/packages/fps-importer/handler.ts +++ b/packages/fps-importer/handler.ts @@ -39,8 +39,14 @@ class FpsProblemImportHandler extends Handler { await problem.addTestdata(domainId, pid, 'config.yaml', Buffer.from(`time: ${config.time}\nmemory: ${config.memory}`)); if (p.test_output) { for (let i = 0; i < p.test_input.length; i++) { - await problem.addTestdata(domainId, pid, `${i + 1}.in`, Buffer.from(p.test_input[i])); - await problem.addTestdata(domainId, pid, `${i + 1}.out`, Buffer.from(p.test_output[i])); + await problem.addTestdata( + domainId, pid, `${i + 1}.in`, + Buffer.from(p.test_input[i]._ || p.test_input[i]), + ); + await problem.addTestdata( + domainId, pid, `${i + 1}.out`, + Buffer.from(p.test_output[i]._ || p.test_output[i]), + ); } } else if (p.test_input) { for (let i = 0; i < p.test_input.length / 2; i++) { diff --git a/packages/fps-importer/package.json b/packages/fps-importer/package.json index cb06c1808..1ea0593c6 100644 --- a/packages/fps-importer/package.json +++ b/packages/fps-importer/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/fps-importer", - "version": "1.1.12", + "version": "1.1.13", "description": "Import FPS problems", "main": "package.json", "repository": "https://github.com/hydro-dev/Hydro.git",