judge: change testdata download logic

This commit is contained in:
undefined committed 2020-12-19 01:34:03 +08:00
1 parent fc3321688f
commit 558fe34db1
3 files changed
+53 -107

No files matched your search

+3 -2
View File
@@ -9,6 +9,7 @@ import {
Rdoc, TestCase, RunConfig, ContestInfo, ProblemConfig,
} from '../interface';
import db from '../service/db';
import storage from '../service/storage';
export const coll: Collection<Rdoc> = db.collection('record');
@@ -57,11 +58,11 @@ export async function get(domainId: string, _id: ObjectID): Promise<Rdoc | null>
export async function judge(domainId: string, rid: ObjectID, priority = 1) {
const rdoc = await get(domainId, rid);
let config: RunConfig | ProblemConfig = rdoc.config;
let data;
let data = [];
if (rdoc.pid) {
const pdoc = await problem.get(domainId, rdoc.pid);
data = await storage.list(`problem/${domainId}/${rdoc.pid}/testdata/`);
if (!config) config = pdoc?.config || {};
data = pdoc?.data;
}
delete rdoc._id;
await task.add({