mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: ensure testcase order
This commit is contained in:
1 parent
098e681d79
commit
b3de1a4247
8 files changed
+28
-69
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/hydrojudge",
|
"name": "@hydrooj/hydrojudge",
|
||||||
"bin": "bin/hydrojudge.js",
|
"bin": "bin/hydrojudge.js",
|
||||||
"version": "2.11.9",
|
"version": "2.11.10",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ class JudgeTask {
|
|||||||
data: any[];
|
data: any[];
|
||||||
folder: string;
|
folder: string;
|
||||||
config: any;
|
config: any;
|
||||||
nextId = 1;
|
|
||||||
nextWaiting = [];
|
|
||||||
getLang: (name: string) => LangConfig;
|
getLang: (name: string) => LangConfig;
|
||||||
|
|
||||||
constructor(session: Hydro, request, ws: WebSocket) {
|
constructor(session: Hydro, request, ws: WebSocket) {
|
||||||
@@ -135,30 +133,14 @@ class JudgeTask {
|
|||||||
delete data.judge_text;
|
delete data.judge_text;
|
||||||
if (data.case) {
|
if (data.case) {
|
||||||
data.case = {
|
data.case = {
|
||||||
|
id,
|
||||||
status: data.case.status,
|
status: data.case.status,
|
||||||
time: data.case.time_ms || data.case.time,
|
time: data.case.time_ms || data.case.time,
|
||||||
memory: data.case.memory_kb || data.case.memory,
|
memory: data.case.memory_kb || data.case.memory,
|
||||||
message: data.case.message || data.case.judgeText || data.case.judge_text || '',
|
message: data.case.message || data.case.judgeText || data.case.judge_text || '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (id) {
|
|
||||||
if (id === this.nextId) {
|
|
||||||
this.ws.send(JSON.stringify(data));
|
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end(data) {
|
end(data) {
|
||||||
|
|||||||
@@ -100,8 +100,6 @@ async function postInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getNext(that) {
|
function getNext(that) {
|
||||||
that.nextId = 1;
|
|
||||||
that.nextWaiting = [];
|
|
||||||
return (data, id = 0) => {
|
return (data, id = 0) => {
|
||||||
logger.debug('Next: %d %o', id, data);
|
logger.debug('Next: %d %o', id, data);
|
||||||
data.rid = new ObjectID(that.rid);
|
data.rid = new ObjectID(that.rid);
|
||||||
@@ -113,30 +111,14 @@ async function postInit() {
|
|||||||
delete data.compiler_text;
|
delete data.compiler_text;
|
||||||
if (data.case) {
|
if (data.case) {
|
||||||
data.case = {
|
data.case = {
|
||||||
|
id,
|
||||||
status: data.case.status,
|
status: data.case.status,
|
||||||
time: data.case.time_ms || data.case.time,
|
time: data.case.time_ms || data.case.time,
|
||||||
memory: data.case.memory_kb || data.case.memory,
|
memory: data.case.memory_kb || data.case.memory,
|
||||||
message: data.case.message || data.case.judgeText || '',
|
message: data.case.message || data.case.judgeText || '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (id) {
|
|
||||||
if (id === that.nextId) {
|
|
||||||
_judge.next(data);
|
_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);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.39.23",
|
"version": "2.39.24",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export async function next(body: JudgeResultBody) {
|
|||||||
const $push: any = {};
|
const $push: any = {};
|
||||||
if (body.case) {
|
if (body.case) {
|
||||||
const c: TestCase = {
|
const c: TestCase = {
|
||||||
|
id: body.case.id || 0,
|
||||||
memory: body.case.memory,
|
memory: body.case.memory,
|
||||||
time: body.case.time,
|
time: body.case.time,
|
||||||
message: body.case.message || '',
|
message: body.case.message || '',
|
||||||
|
|||||||
@@ -270,10 +270,11 @@ export interface ProblemStatusDoc extends StatusDoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface TestCase {
|
export interface TestCase {
|
||||||
time: number,
|
id?: number;
|
||||||
memory: number,
|
time: number;
|
||||||
status: number,
|
memory: number;
|
||||||
message: string,
|
status: number;
|
||||||
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RecordDoc {
|
export interface RecordDoc {
|
||||||
@@ -476,26 +477,23 @@ export interface Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface JudgeResultBody {
|
export interface JudgeResultBody {
|
||||||
domainId: string,
|
domainId: string;
|
||||||
rid: ObjectID,
|
rid: ObjectID;
|
||||||
judger?: number,
|
judger?: number;
|
||||||
progress?: number
|
progress?: number;
|
||||||
case?: {
|
case?: {
|
||||||
status: number,
|
id?: number;
|
||||||
time: number,
|
status: number;
|
||||||
memory: number,
|
time: number;
|
||||||
message?: string,
|
memory: number;
|
||||||
|
message?: string;
|
||||||
},
|
},
|
||||||
status?: number,
|
status?: number;
|
||||||
score?: number,
|
score?: number;
|
||||||
time?: number,
|
time?: number;
|
||||||
memory?: number,
|
memory?: number;
|
||||||
message?: string,
|
message?: string;
|
||||||
compilerText?: string,
|
compilerText?: string,
|
||||||
|
|
||||||
// For pretest
|
|
||||||
stdout?: string,
|
|
||||||
stderr?: string,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Task {
|
export interface Task {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.25.6",
|
"version": "4.25.7",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -36,21 +36,17 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{%- for rcdoc in rdoc.testCases -%}
|
{%- for rcdoc in rdoc.testCases|sort(false,false,'id') -%}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col--case record-status--border {{ model.builtin.STATUS_CODES[rcdoc['status']] }}">
|
<td class="col--case record-status--border {{ model.builtin.STATUS_CODES[rcdoc['status']] }}">
|
||||||
#{{ loop.index }}
|
#{{ rcdoc.id or loop.index }}
|
||||||
</td>
|
</td>
|
||||||
<td class="col--status">
|
<td class="col--status">
|
||||||
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rcdoc['status']] }}"></span>
|
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rcdoc['status']] }}"></span>
|
||||||
<span class="record-status--text {{ model.builtin.STATUS_CODES[rcdoc['status']] }}">
|
<span class="record-status--text {{ model.builtin.STATUS_CODES[rcdoc['status']] }}">
|
||||||
{{ model.builtin.STATUS_TEXTS[rcdoc['status']] }}
|
{{ model.builtin.STATUS_TEXTS[rcdoc['status']] }}
|
||||||
</span>
|
</span>
|
||||||
<span>{% if rdoc.domainId=='bzoj' and rcdoc.status!=STATUS.STATUS_ACCEPTED and not dl %}
|
<span>{{ formatJudgeTexts([rcdoc.message]) if rcdoc.message else '' }}</span>
|
||||||
{% 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>
|
|
||||||
</td>
|
</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--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>
|
<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