vjudge: add state check

pull/210/head
undefined 3 years ago
parent f5e4b5c50a
commit 481bf3fe3a

@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/vjudge", "name": "@hydrooj/vjudge",
"version": "1.3.2", "version": "1.3.3",
"description": "Submit problems to remote oj", "description": "Submit problems to remote oj",
"main": "package.json", "main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git", "repository": "https://github.com/hydro-dev/Hydro.git",

@ -136,21 +136,23 @@ export default class LuoguProvider implements IBasicProvider {
logger.info('Fetched with length', JSON.stringify(body).length); logger.info('Fetched with length', JSON.stringify(body).length);
const total = flattenDeep(body.currentData.testCaseGroup).length; const total = flattenDeep(body.currentData.testCaseGroup).length;
// TODO sorted // TODO sorted
for (const subtask of data.detail?.judgeResult?.subtasks || []) { if (data.detail.judgeResult) {
for (const cid of Object.keys(subtask.testCases)) { for (const subtask of data.detail.judgeResult?.subtasks || []) {
if (done[`${subtask.id}.${cid}`]) continue; for (const cid of Object.keys(subtask.testCases)) {
done[`${subtask.id}.${cid}`] = true; if (done[`${subtask.id}.${cid}`]) continue;
const testcase = subtask.testCases[cid]; done[`${subtask.id}.${cid}`] = true;
await next({ const testcase = subtask.testCases[cid];
status: STATUS.STATUS_JUDGING, await next({
case: { status: STATUS.STATUS_JUDGING,
status: STATUS_MAP[testcase.status], case: {
time: testcase.time, status: STATUS_MAP[testcase.status],
memory: testcase.memory, time: testcase.time,
message: testcase.description, memory: testcase.memory,
}, message: testcase.description,
progress: (Object.keys(done).length / total) * 100, },
}); progress: (Object.keys(done).length / total) * 100,
});
}
} }
} }
if (data.status < 2) continue; if (data.status < 2) continue;

Loading…
Cancel
Save