ui: ensure testcase order

This commit is contained in:
undefined committed 2021-10-15 19:43:07 +08:00
1 parent 098e681d79
commit b3de1a4247
8 files changed
+30 -71

No files matched your search

+2 -20
View File
@@ -39,8 +39,6 @@ class JudgeTask {
data: any[];
folder: string;
config: any;
nextId = 1;
nextWaiting = [];
getLang: (name: string) => LangConfig;
constructor(session: Hydro, request, ws: WebSocket) {
@@ -135,30 +133,14 @@ class JudgeTask {
delete data.judge_text;
if (data.case) {
data.case = {
id,
status: data.case.status,
time: data.case.time_ms || data.case.time,
memory: data.case.memory_kb || data.case.memory,
message: data.case.message || data.case.judgeText || data.case.judge_text || '',
};
}
if (id) {
if (id === this.nextId) {
this.ws.send(JSON.stringify(data));
this.nextId++;
let t = true;
while (t) {
t = false;
for (const i in this.nextWaiting) {
if (this.nextId === this.nextWaiting[i].id) {
this.ws.send(JSON.stringify(this.nextWaiting[i].data));
this.nextId++;
this.nextWaiting.splice(+i, 1);
t = true;
}
}
}
} else this.nextWaiting.push({ data, id });
} else this.ws.send(JSON.stringify(data));
this.ws.send(JSON.stringify(data));
}
end(data) {