mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: ensure testcase order
This commit is contained in:
1 parent
098e681d79
commit
b3de1a4247
8 files changed
+30
-71
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.11.9",
|
||||
"version": "2.11.10",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -100,8 +100,6 @@ async function postInit() {
|
||||
}
|
||||
|
||||
function getNext(that) {
|
||||
that.nextId = 1;
|
||||
that.nextWaiting = [];
|
||||
return (data, id = 0) => {
|
||||
logger.debug('Next: %d %o', id, data);
|
||||
data.rid = new ObjectID(that.rid);
|
||||
@@ -113,30 +111,14 @@ async function postInit() {
|
||||
delete data.compiler_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 || '',
|
||||
};
|
||||
}
|
||||
if (id) {
|
||||
if (id === that.nextId) {
|
||||
_judge.next(data);
|
||||
that.nextId++;
|
||||
let t = true;
|
||||
while (t) {
|
||||
t = false;
|
||||
for (const i in that.nextWaiting) {
|
||||
if (that.nextId === that.nextWaiting[i].id) {
|
||||
_judge.next(that.nextWaiting[i].data);
|
||||
that.nextId++;
|
||||
that.nextWaiting.splice(i, 1);
|
||||
t = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else that.nextWaiting.push({ data, id });
|
||||
} else _judge.next(data);
|
||||
_judge.next(data);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.39.23",
|
||||
"version": "2.39.24",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -59,6 +59,7 @@ export async function next(body: JudgeResultBody) {
|
||||
const $push: any = {};
|
||||
if (body.case) {
|
||||
const c: TestCase = {
|
||||
id: body.case.id || 0,
|
||||
memory: body.case.memory,
|
||||
time: body.case.time,
|
||||
message: body.case.message || '',
|
||||
|
||||
@@ -270,10 +270,11 @@ export interface ProblemStatusDoc extends StatusDoc {
|
||||
}
|
||||
|
||||
export interface TestCase {
|
||||
time: number,
|
||||
memory: number,
|
||||
status: number,
|
||||
message: string,
|
||||
id?: number;
|
||||
time: number;
|
||||
memory: number;
|
||||
status: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface RecordDoc {
|
||||
@@ -476,26 +477,23 @@ export interface Script {
|
||||
}
|
||||
|
||||
export interface JudgeResultBody {
|
||||
domainId: string,
|
||||
rid: ObjectID,
|
||||
judger?: number,
|
||||
progress?: number
|
||||
domainId: string;
|
||||
rid: ObjectID;
|
||||
judger?: number;
|
||||
progress?: number;
|
||||
case?: {
|
||||
status: number,
|
||||
time: number,
|
||||
memory: number,
|
||||
message?: string,
|
||||
id?: number;
|
||||
status: number;
|
||||
time: number;
|
||||
memory: number;
|
||||
message?: string;
|
||||
},
|
||||
status?: number,
|
||||
score?: number,
|
||||
time?: number,
|
||||
memory?: number,
|
||||
message?: string,
|
||||
status?: number;
|
||||
score?: number;
|
||||
time?: number;
|
||||
memory?: number;
|
||||
message?: string;
|
||||
compilerText?: string,
|
||||
|
||||
// For pretest
|
||||
stdout?: string,
|
||||
stderr?: string,
|
||||
}
|
||||
|
||||
export interface Task {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.25.6",
|
||||
"version": "4.25.7",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
@@ -36,21 +36,17 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{%- for rcdoc in rdoc.testCases -%}
|
||||
{%- for rcdoc in rdoc.testCases|sort(false,false,'id') -%}
|
||||
<tr>
|
||||
<td class="col--case record-status--border {{ model.builtin.STATUS_CODES[rcdoc['status']] }}">
|
||||
#{{ loop.index }}
|
||||
#{{ rcdoc.id or loop.index }}
|
||||
</td>
|
||||
<td class="col--status">
|
||||
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rcdoc['status']] }}"></span>
|
||||
<span class="record-status--text {{ model.builtin.STATUS_CODES[rcdoc['status']] }}">
|
||||
{{ model.builtin.STATUS_TEXTS[rcdoc['status']] }}
|
||||
</span>
|
||||
<span>{% if rdoc.domainId=='bzoj' and rcdoc.status!=STATUS.STATUS_ACCEPTED and not dl %}
|
||||
{% set dl=true %}
|
||||
<a href="/d/bzoj/p/{{rdoc.pid}}/file/{{loop.index}}.in?type=testdata&rid={{ rdoc._id }}">input</a>
|
||||
<a href="/d/bzoj/p/{{rdoc.pid}}/file/{{loop.index}}.out?type=testdata&rid={{ rdoc._id }}">output</a>
|
||||
{% endif %}{{ formatJudgeTexts([rcdoc.message]) if rcdoc.message else '' }}</span>
|
||||
<span>{{ formatJudgeTexts([rcdoc.message]) if rcdoc.message else '' }}</span>
|
||||
</td>
|
||||
<td class="col--time">{% if rcdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rcdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rcdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %}≥{% endif %}{{ rcdoc.time|round|int }}ms</td>
|
||||
<td class="col--memory">{% if rcdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rcdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rcdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %}≥{% endif %}{{ size(rcdoc.memory, 1024) }}</td>
|
||||
|
||||
Reference in new issue
Block a user