mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
migrate-hustoj: handle testdata
This commit is contained in:
1 parent
f768e96867
commit
165c9d071c
2 files changed
+6
-4
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/migrate-hustoj",
|
"name": "@hydrooj/migrate-hustoj",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
|
|||||||
@@ -268,13 +268,15 @@ export async function run({
|
|||||||
const files = await fs.readdir(dataDir, { withFileTypes: true });
|
const files = await fs.readdir(dataDir, { withFileTypes: true });
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (!file.isDirectory()) continue;
|
if (!file.isDirectory()) continue;
|
||||||
if (!pidMap[file.name]) continue;
|
|
||||||
report({ message: `Syncing testdata for ${file.name}` });
|
|
||||||
const datas = await fs.readdir(`${dataDir}/${file.name}`);
|
const datas = await fs.readdir(`${dataDir}/${file.name}`);
|
||||||
|
const pdoc = await problem.get(domainId, `P${file.name}`, undefined, true);
|
||||||
|
if (!pdoc) continue;
|
||||||
|
report({ message: `Syncing testdata for ${file.name}` });
|
||||||
for (const data of datas) {
|
for (const data of datas) {
|
||||||
const filename = nameMap[data] || data;
|
const filename = nameMap[data] || data;
|
||||||
await problem.addTestdata(domainId, pidMap[file.name], filename, `${dataDir}/${file.name}/${data}`);
|
await problem.addTestdata(domainId, pdoc.docId, filename, `${dataDir}/${file.name}/${data}`);
|
||||||
}
|
}
|
||||||
|
await problem.addTestdata(domainId, pdoc.docId, 'config.yaml', Buffer.from(pdoc.config as string));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user