mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
统一PostJudge接口
This commit is contained in:
1 parent
0ee306d0cf
commit
9efcdf9441
9 files changed
+104
-162
No files matched your search
@@ -33,6 +33,7 @@ module.exports = {
|
|||||||
'no-return-await': 'off',
|
'no-return-await': 'off',
|
||||||
'no-underscore-dangle': 'off',
|
'no-underscore-dangle': 'off',
|
||||||
'no-unused-vars': 'off',
|
'no-unused-vars': 'off',
|
||||||
|
'prefer-destructuring': 'off',
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
'import/parsers': {
|
'import/parsers': {
|
||||||
|
|||||||
+47
-27
@@ -1,6 +1,7 @@
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { ObjectID } from 'mongodb';
|
import { ObjectID } from 'mongodb';
|
||||||
import { parseTimeMS, parseMemoryMB } from '../utils';
|
import { parseTimeMS, parseMemoryMB } from '../utils';
|
||||||
|
import { JudgeResultBody, Rdoc } from '../interface';
|
||||||
import * as record from '../model/record';
|
import * as record from '../model/record';
|
||||||
import * as problem from '../model/problem';
|
import * as problem from '../model/problem';
|
||||||
import * as builtin from '../model/builtin';
|
import * as builtin from '../model/builtin';
|
||||||
@@ -12,12 +13,31 @@ import {
|
|||||||
Route, Handler, Connection, ConnectionHandler, Types, param,
|
Route, Handler, Connection, ConnectionHandler, Types, param,
|
||||||
} from '../service/server';
|
} from '../service/server';
|
||||||
|
|
||||||
async function _postJudge(rdoc) {
|
interface _PostJudgeBody {
|
||||||
|
status: number,
|
||||||
|
domainId: string,
|
||||||
|
uid: number,
|
||||||
|
_id: ObjectID,
|
||||||
|
pid: number,
|
||||||
|
score: number,
|
||||||
|
rejudged: boolean,
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PostJudgeBodyContest extends _PostJudgeBody {
|
||||||
|
tid: ObjectID,
|
||||||
|
ttype: number,
|
||||||
|
}
|
||||||
|
|
||||||
|
type PostJudgeBody = _PostJudgeBody | PostJudgeBodyContest;
|
||||||
|
|
||||||
|
function _isWithContest(v: PostJudgeBody): v is PostJudgeBodyContest {
|
||||||
|
return !!((v as PostJudgeBodyContest).tid);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function _postJudge(rdoc: PostJudgeBody) {
|
||||||
const accept = rdoc.status === builtin.STATUS.STATUS_ACCEPTED;
|
const accept = rdoc.status === builtin.STATUS.STATUS_ACCEPTED;
|
||||||
bus.publish('record_change', rdoc);
|
|
||||||
if (rdoc.type === 'run') return;
|
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
if (rdoc.tid) {
|
if (_isWithContest(rdoc)) {
|
||||||
tasks.push(
|
tasks.push(
|
||||||
contest.updateStatus(
|
contest.updateStatus(
|
||||||
rdoc.domainId, rdoc.tid, rdoc.uid,
|
rdoc.domainId, rdoc.tid, rdoc.uid,
|
||||||
@@ -36,7 +56,7 @@ async function _postJudge(rdoc) {
|
|||||||
await Promise.all(tasks);
|
await Promise.all(tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function next(body) {
|
export async function next(body: JudgeResultBody) {
|
||||||
if (body.rid) body.rid = new ObjectID(body.rid);
|
if (body.rid) body.rid = new ObjectID(body.rid);
|
||||||
if (body.tid) body.tid = new ObjectID(body.tid);
|
if (body.tid) body.tid = new ObjectID(body.tid);
|
||||||
let rdoc = await record.get(body.domainId, body.rid);
|
let rdoc = await record.get(body.domainId, body.rid);
|
||||||
@@ -44,56 +64,56 @@ export async function next(body) {
|
|||||||
const $push: any = {};
|
const $push: any = {};
|
||||||
if (body.case) {
|
if (body.case) {
|
||||||
const c: any = {};
|
const c: any = {};
|
||||||
c.memory = body.case.memory_kb || body.case.memory;
|
c.memory = body.case.memory;
|
||||||
c.time = body.case.time_ms || body.case.time;
|
c.time = body.case.time;
|
||||||
c.judgeText = body.case.judge_text || body.case.judgeText || body.case.message;
|
c.message = body.case.message;
|
||||||
c.status = body.case.status;
|
c.status = body.case.status;
|
||||||
rdoc.testCases.push(c);
|
rdoc.testCases.push(c);
|
||||||
$push.testCases = c;
|
$push.testCases = c;
|
||||||
}
|
}
|
||||||
if (body.judge_text || body.message) {
|
if (body.message) {
|
||||||
rdoc.judgeTexts.push(body.judge_text || body.message);
|
rdoc.judgeTexts.push(body.message);
|
||||||
$push.judgeTexts = body.judge_text || body.message;
|
$push.judgeTexts = body.message;
|
||||||
}
|
}
|
||||||
if (body.compiler_text) {
|
if (body.compilerText) {
|
||||||
rdoc.compilerTexts.push(body.compiler_text);
|
rdoc.compilerTexts.push(body.compilerText);
|
||||||
$push.compilerTexts = body.compiler_text;
|
$push.compilerTexts = body.compilerText;
|
||||||
}
|
}
|
||||||
if (body.status) $set.status = body.status;
|
if (body.status) $set.status = body.status;
|
||||||
if (body.score) $set.score = body.score;
|
if (body.score) $set.score = body.score;
|
||||||
if (body.time_ms) $set.time = body.time_ms || body.time;
|
if (body.time) $set.time = body.time;
|
||||||
if (body.memory_kb) $set.memory = body.memory_kb || body.memory;
|
if (body.memory) $set.memory = body.memory;
|
||||||
if (body.progress) $set.progress = body.progress;
|
if (body.progress) $set.progress = body.progress;
|
||||||
rdoc = await record.update(body.domainId, body.rid, $set, $push);
|
rdoc = await record.update(body.domainId, body.rid, $set, $push);
|
||||||
bus.publish('record_change', rdoc);
|
bus.publish('record_change', { rdoc, $set, $push });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function end(body) {
|
export async function end(body: JudgeResultBody) {
|
||||||
if (body.rid) body.rid = new ObjectID(body.rid);
|
if (body.rid) body.rid = new ObjectID(body.rid);
|
||||||
if (body.tid) body.tid = new ObjectID(body.tid);
|
if (body.tid) body.tid = new ObjectID(body.tid);
|
||||||
let rdoc = await record.get(body.domainId, body.rid);
|
let rdoc = await record.get(body.domainId, body.rid);
|
||||||
const $set: any = {};
|
const $set: any = {};
|
||||||
const $push: any = {};
|
const $push: any = {};
|
||||||
const $unset = { progress: '' };
|
const $unset = { progress: '' };
|
||||||
if (body.judge_text) {
|
if (body.message) {
|
||||||
rdoc.judgeTexts.push(body.judge_text);
|
rdoc.judgeTexts.push(body.message);
|
||||||
$push.judgeTexts = body.judge_text;
|
$push.judgeTexts = body.message;
|
||||||
}
|
}
|
||||||
if (body.compiler_text) {
|
if (body.compilerText) {
|
||||||
rdoc.compilerTexts.push(body.compiler_text);
|
rdoc.compilerTexts.push(body.compilerText);
|
||||||
$push.compilerTexts = body.compiler_text;
|
$push.compilerTexts = body.compilerText;
|
||||||
}
|
}
|
||||||
if (body.status) $set.status = body.status;
|
if (body.status) $set.status = body.status;
|
||||||
if (body.score) $set.score = body.score;
|
if (body.score) $set.score = body.score;
|
||||||
if (body.stdout) $set.stdout = body.stdout;
|
if (body.stdout) $set.stdout = body.stdout;
|
||||||
if (body.stderr) $set.stderr = body.stderr;
|
if (body.stderr) $set.stderr = body.stderr;
|
||||||
if (body.time_ms) $set.time = body.time_ms;
|
if (body.time) $set.time = body.time;
|
||||||
if (body.memory_kb) $set.memory = body.memory_kb;
|
if (body.memory) $set.memory = body.memory;
|
||||||
$set.judgeAt = new Date();
|
$set.judgeAt = new Date();
|
||||||
$set.judger = body.judger;
|
$set.judger = body.judger;
|
||||||
rdoc = await record.update(body.domainId, body.rid, $set, $push, $unset);
|
rdoc = await record.update(body.domainId, body.rid, $set, $push, $unset);
|
||||||
await _postJudge(rdoc);
|
await _postJudge(rdoc);
|
||||||
rdoc = await record.update(body.domainId, body.rid, $set, $push);
|
bus.publish('record_change', { rdoc }); // trigger a full update
|
||||||
}
|
}
|
||||||
|
|
||||||
class PretestHandler extends Handler {
|
class PretestHandler extends Handler {
|
||||||
|
|||||||
@@ -128,10 +128,10 @@ class SystemScriptHandler extends SystemHandler {
|
|||||||
domainId,
|
domainId,
|
||||||
rid,
|
rid,
|
||||||
status: STATUS.STATUS_ACCEPTED,
|
status: STATUS.STATUS_ACCEPTED,
|
||||||
judge_text: ret.toString(),
|
message: ret.toString(),
|
||||||
judger: 1,
|
judger: 1,
|
||||||
time_ms: time,
|
time,
|
||||||
memory_kb: 0,
|
memory: 0,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err: Error) => {
|
.catch((err: Error) => {
|
||||||
@@ -140,10 +140,10 @@ class SystemScriptHandler extends SystemHandler {
|
|||||||
domainId,
|
domainId,
|
||||||
rid,
|
rid,
|
||||||
status: STATUS.STATUS_SYSTEM_ERROR,
|
status: STATUS.STATUS_SYSTEM_ERROR,
|
||||||
judge_text: `${err}\n${err.stack}`,
|
message: `${err}\n${err.stack}`,
|
||||||
judger: 1,
|
judger: 1,
|
||||||
time_ms: time,
|
time,
|
||||||
memory_kb: 0,
|
memory: 0,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ class ProblemPretestConnectionHandler extends ConnectionHandler {
|
|||||||
@param('pid', Types.String)
|
@param('pid', Types.String)
|
||||||
async prepare(domainId: string, pid: string) {
|
async prepare(domainId: string, pid: string) {
|
||||||
const pdoc = await problem.get(domainId, pid);
|
const pdoc = await problem.get(domainId, pid);
|
||||||
|
if (pdoc.hidden) this.checkPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN);
|
||||||
if (!pdoc) throw new ProblemNotFoundError(domainId, pid);
|
if (!pdoc) throw new ProblemNotFoundError(domainId, pid);
|
||||||
this.pid = pdoc.docId.toString();
|
this.pid = pdoc.docId.toString();
|
||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
@@ -261,12 +262,18 @@ class ProblemPretestConnectionHandler extends ConnectionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onRecordChange(data) {
|
async onRecordChange(data) {
|
||||||
const rdoc: Rdoc = data.value;
|
const rdoc: Rdoc = data.value.rdoc;
|
||||||
if (
|
if (
|
||||||
rdoc.uid !== this.user._id
|
rdoc.uid !== this.user._id
|
||||||
|| rdoc.pid.toString() !== this.pid
|
|| rdoc.pid.toString() !== this.pid
|
||||||
|| rdoc.domainId !== this.domainId
|
|| rdoc.domainId !== this.domainId
|
||||||
) return;
|
) return;
|
||||||
|
rdoc.compilerTexts = [];
|
||||||
|
rdoc.judgeTexts = [];
|
||||||
|
// @ts-ignore
|
||||||
|
rdoc.testCases = rdoc.testCases.map((c) => ({
|
||||||
|
status: c.status,
|
||||||
|
}));
|
||||||
if (rdoc.tid) return;
|
if (rdoc.tid) return;
|
||||||
this.send({ rdoc });
|
this.send({ rdoc });
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-4
@@ -11,6 +11,7 @@ import * as bus from '../service/bus';
|
|||||||
import {
|
import {
|
||||||
Route, Handler, Connection, ConnectionHandler, Types, param,
|
Route, Handler, Connection, ConnectionHandler, Types, param,
|
||||||
} from '../service/server';
|
} from '../service/server';
|
||||||
|
import { Rdoc } from '../interface';
|
||||||
|
|
||||||
const RecordHandler = contest.ContestHandlerMixin(Handler);
|
const RecordHandler = contest.ContestHandlerMixin(Handler);
|
||||||
|
|
||||||
@@ -117,8 +118,9 @@ class RecordMainConnectionHandler extends RecordConnectionHandler {
|
|||||||
|
|
||||||
async message(msg) {
|
async message(msg) {
|
||||||
if (msg.rids instanceof Array) {
|
if (msg.rids instanceof Array) {
|
||||||
|
const rids = msg.rids.map((id: string) => new ObjectID(id));
|
||||||
const rdocs = await record.getMulti(
|
const rdocs = await record.getMulti(
|
||||||
this.domainId, { _id: { $in: msg.rids.map((id) => new ObjectID(id)) } },
|
this.domainId, { _id: { $in: rids } },
|
||||||
).toArray();
|
).toArray();
|
||||||
for (const rdoc of rdocs) {
|
for (const rdoc of rdocs) {
|
||||||
this.onRecordChange({ value: rdoc });
|
this.onRecordChange({ value: rdoc });
|
||||||
@@ -131,7 +133,7 @@ class RecordMainConnectionHandler extends RecordConnectionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onRecordChange(data) {
|
async onRecordChange(data) {
|
||||||
const rdoc = data.value;
|
const rdoc: Rdoc = data.value.rdoc;
|
||||||
if (rdoc.tid && rdoc.tid.toString() !== this.tid) return;
|
if (rdoc.tid && rdoc.tid.toString() !== this.tid) return;
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
let [udoc, pdoc] = await Promise.all([
|
let [udoc, pdoc] = await Promise.all([
|
||||||
@@ -139,7 +141,7 @@ class RecordMainConnectionHandler extends RecordConnectionHandler {
|
|||||||
problem.get(this.domainId, rdoc.pid, null, false),
|
problem.get(this.domainId, rdoc.pid, null, false),
|
||||||
]);
|
]);
|
||||||
if (pdoc && pdoc.hidden && !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = null;
|
if (pdoc && pdoc.hidden && !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = null;
|
||||||
this.send({ html: await this.renderHTML('record_main_tr.html', { rdoc, udoc, pdoc }) });
|
else this.send({ html: await this.renderHTML('record_main_tr.html', { rdoc, udoc, pdoc }) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,13 +162,17 @@ class RecordDetailConnectionHandler extends contest.ContestHandlerMixin(Connecti
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onRecordChange(data) {
|
async onRecordChange(data) {
|
||||||
const rdoc = data.value;
|
const rdoc: Rdoc = data.value.rdoc;
|
||||||
|
const { $set, $push } = data.value;
|
||||||
if (rdoc._id.toString() !== this.rid) return;
|
if (rdoc._id.toString() !== this.rid) return;
|
||||||
|
if ($set) this.send({ $set, $push });
|
||||||
|
else {
|
||||||
this.send({
|
this.send({
|
||||||
status_html: await this.renderHTML('record_detail_status.html', { rdoc }),
|
status_html: await this.renderHTML('record_detail_status.html', { rdoc }),
|
||||||
summary_html: await this.renderHTML('record_detail_summary.html', { rdoc }),
|
summary_html: await this.renderHTML('record_detail_summary.html', { rdoc }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async cleanup() {
|
async cleanup() {
|
||||||
bus.unsubscribe(['record_change'], this, 'onRecordChange');
|
bus.unsubscribe(['record_change'], this, 'onRecordChange');
|
||||||
|
|||||||
@@ -199,6 +199,30 @@ export interface Script {
|
|||||||
validate: any,
|
validate: any,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface JudgeResultBody {
|
||||||
|
domainId: string,
|
||||||
|
rid: ObjectID,
|
||||||
|
judger?: number,
|
||||||
|
tid?: ObjectID,
|
||||||
|
progress?: number
|
||||||
|
case?: {
|
||||||
|
status: 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,
|
||||||
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace NodeJS {
|
namespace NodeJS {
|
||||||
interface Global {
|
interface Global {
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ async function runContest(...arg: Array<any>) {
|
|||||||
await report({
|
await report({
|
||||||
case: {
|
case: {
|
||||||
status: STATUS.STATUS_ACCEPTED,
|
status: STATUS.STATUS_ACCEPTED,
|
||||||
judgeText: `Contest ${tdoc.title} finished`,
|
message: `Contest ${tdoc.title} finished`,
|
||||||
time_ms: new Date().getTime() - start,
|
time: new Date().getTime() - start,
|
||||||
memory_kb: 0,
|
memory: 0,
|
||||||
score: 0,
|
score: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -115,9 +115,9 @@ export async function run({ domainId }, report: Function) {
|
|||||||
await report({
|
await report({
|
||||||
case: {
|
case: {
|
||||||
status: STATUS.STATUS_ACCEPTED,
|
status: STATUS.STATUS_ACCEPTED,
|
||||||
judgeText: `Domain ${domains[i]._id} finished`,
|
message: `Domain ${domains[i]._id} finished`,
|
||||||
time_ms: new Date().getTime() - start,
|
time: new Date().getTime() - start,
|
||||||
memory_kb: 0,
|
memory: 0,
|
||||||
score: 0,
|
score: 0,
|
||||||
},
|
},
|
||||||
progress: Math.floor(((parseInt(i, 10) + 1) / domains.length) * 100),
|
progress: Math.floor(((parseInt(i, 10) + 1) / domains.length) * 100),
|
||||||
|
|||||||
@@ -700,6 +700,8 @@ export class ConnectionHandler {
|
|||||||
this.conn.close(code.toString(), reason);
|
this.conn.close(code.toString(), reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async message(message: any) { } // eslint-disable-line
|
||||||
|
|
||||||
onerror(err: HydroError) {
|
onerror(err: HydroError) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.send({
|
this.send({
|
||||||
|
|||||||
@@ -1,118 +0,0 @@
|
|||||||
import { NamedPage } from 'vj/misc/PageLoader';
|
|
||||||
|
|
||||||
import * as recordEnum from 'vj/constant/record';
|
|
||||||
|
|
||||||
const page = new NamedPage('judge_playground', async () => {
|
|
||||||
const { default: SockJs } = await import('../components/socket');
|
|
||||||
|
|
||||||
const sock = new SockJs(`/judge/consume-conn?token=${UiContext.token}`);
|
|
||||||
sock.onopen = () => {
|
|
||||||
const div = $('<div class="section visible">').appendTo('#messages');
|
|
||||||
$('<div class="section__header"><h1 class="section__title">Connection opened.</h1></div>')
|
|
||||||
.appendTo(div);
|
|
||||||
};
|
|
||||||
|
|
||||||
sock.onmessage = (message) => {
|
|
||||||
const msg = JSON.parse(message.data);
|
|
||||||
const div = $('<div class="section visible">').appendTo('#messages');
|
|
||||||
$('<div class="section__header"><h1 class="section__title">Record</h1></div>')
|
|
||||||
.appendTo(div);
|
|
||||||
const body = $('<div class="section__body">').text(message.data).appendTo(div);
|
|
||||||
|
|
||||||
const send = (key, packet) => {
|
|
||||||
const data = {
|
|
||||||
...packet,
|
|
||||||
key,
|
|
||||||
tag: msg.tag,
|
|
||||||
};
|
|
||||||
sock.send(JSON.stringify(data));
|
|
||||||
};
|
|
||||||
|
|
||||||
$('<button class="button rounded primary">').text('Compile')
|
|
||||||
.on('click', () => {
|
|
||||||
send('next', { status: 20 });
|
|
||||||
})
|
|
||||||
.appendTo(body);
|
|
||||||
|
|
||||||
$('<button class="button rounded primary">').text('Point0')
|
|
||||||
.on('click', () => {
|
|
||||||
send('next', {
|
|
||||||
case: {
|
|
||||||
status: recordEnum.STATUS_WRONG_ANSWER,
|
|
||||||
score: 0,
|
|
||||||
time_ms: 1,
|
|
||||||
memory_kb: 777,
|
|
||||||
judge_text: 'from playground',
|
|
||||||
},
|
|
||||||
progress: 51.123,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.appendTo(body);
|
|
||||||
|
|
||||||
$('<button class="button rounded primary">').text('Point10')
|
|
||||||
.on('click', () => {
|
|
||||||
send('next', {
|
|
||||||
case: {
|
|
||||||
status: recordEnum.STATUS_ACCEPTED,
|
|
||||||
score: 10,
|
|
||||||
time_ms: 1,
|
|
||||||
memory_kb: 233,
|
|
||||||
judge_text: 'from playground',
|
|
||||||
},
|
|
||||||
progress: 90.0,
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.appendTo(body);
|
|
||||||
|
|
||||||
$('<button class="button rounded primary">').text('Accept')
|
|
||||||
.on('click', () => {
|
|
||||||
send('end', {
|
|
||||||
status: recordEnum.STATUS_ACCEPTED,
|
|
||||||
score: 100,
|
|
||||||
time_ms: 1,
|
|
||||||
memory_kb: 1,
|
|
||||||
});
|
|
||||||
$('button', div).detach();
|
|
||||||
})
|
|
||||||
.appendTo(body);
|
|
||||||
|
|
||||||
$('<button class="button rounded primary">').text('WA')
|
|
||||||
.on('click', () => {
|
|
||||||
send('end', {
|
|
||||||
status: recordEnum.STATUS_WRONG_ANSWER,
|
|
||||||
score: 88,
|
|
||||||
time_ms: 88,
|
|
||||||
memory_kb: 88,
|
|
||||||
});
|
|
||||||
$('button', div).detach();
|
|
||||||
})
|
|
||||||
.appendTo(body);
|
|
||||||
|
|
||||||
$('<button class="button rounded primary">').text('TLE')
|
|
||||||
.on('click', () => {
|
|
||||||
send('end', {
|
|
||||||
status: recordEnum.STATUS_TIME_LIMIT_EXCEEDED,
|
|
||||||
score: 10,
|
|
||||||
time_ms: 9999,
|
|
||||||
memory_kb: 88,
|
|
||||||
});
|
|
||||||
$('button', div).detach();
|
|
||||||
})
|
|
||||||
.appendTo(body);
|
|
||||||
};
|
|
||||||
|
|
||||||
sock.onclose = (message) => {
|
|
||||||
const div = $('<div class="section visible">').appendTo('#messages');
|
|
||||||
$(`
|
|
||||||
<div class="section__header">
|
|
||||||
<h1 class="section__title">
|
|
||||||
Connection closed,
|
|
||||||
reason=${JSON.stringify(message.reason)}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
`)
|
|
||||||
.appendTo(div);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
export default page;
|
|
||||||
Reference in new issue
Block a user