vjudge: luogu: add finished count

pull/210/head
undefined 3 years ago
parent 9178e5e846
commit 267b792587

@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/vjudge", "name": "@hydrooj/vjudge",
"version": "1.3.4", "version": "1.3.5",
"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",

@ -121,6 +121,7 @@ export default class LuoguProvider implements IBasicProvider {
const done = {}; const done = {};
let fail = 0; let fail = 0;
let count = 0; let count = 0;
let finished = 0;
while (count < 120 && fail < 5) { while (count < 120 && fail < 5) {
await sleep(1500); await sleep(1500);
count++; count++;
@ -135,12 +136,11 @@ 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;
logger.info(total);
logger.info(!!data.detail.judgeResult);
// TODO sorted // TODO sorted
for (const subtask of data.detail.judgeResult?.subtasks || []) { for (const subtask of data.detail.judgeResult?.subtasks || []) {
for (const cid of Object.keys(subtask.testCases)) { for (const cid in subtask.testCases || {}) {
if (done[`${subtask.id}.${cid}`]) continue; if (done[`${subtask.id}.${cid}`]) continue;
finished++;
done[`${subtask.id}.${cid}`] = true; done[`${subtask.id}.${cid}`] = true;
const testcase = subtask.testCases[cid]; const testcase = subtask.testCases[cid];
await next({ await next({
@ -151,7 +151,7 @@ export default class LuoguProvider implements IBasicProvider {
memory: testcase.memory, memory: testcase.memory,
message: testcase.description, message: testcase.description,
}, },
progress: (Object.keys(done).length / total) * 100, progress: (finished / total) * 100,
}); });
} }
} }

Loading…
Cancel
Save