mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: also add postJudge for score_cancel
This commit is contained in:
1 parent
392de5c6e1
commit
4b3e2a8e50
3 files changed
+6
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.28.26",
|
||||
"version": "2.28.27",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -20,7 +20,7 @@ import { updateJudge } from '../service/monitor';
|
||||
|
||||
const logger = new Logger('judge');
|
||||
|
||||
async function _postJudge(rdoc: RecordDoc) {
|
||||
export async function postJudge(rdoc: RecordDoc) {
|
||||
if (typeof rdoc.input === 'string') return;
|
||||
const accept = rdoc.status === builtin.STATUS.STATUS_ACCEPTED;
|
||||
const updated = await problem.updateStatus(rdoc.pdomain, rdoc.pid, rdoc.uid, rdoc._id, rdoc.status, rdoc.score);
|
||||
@@ -99,7 +99,7 @@ export async function end(body: JudgeResultBody) {
|
||||
$set.judger = body.judger ?? 1;
|
||||
await sleep(100); // Make sure that all 'next' event already triggered
|
||||
rdoc = await record.update(rdoc.domainId, body.rid, $set, $push, $unset);
|
||||
await _postJudge(rdoc);
|
||||
await postJudge(rdoc);
|
||||
bus.boardcast('record/change', rdoc); // trigger a full update
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { FilterQuery, ObjectID } from 'mongodb';
|
||||
import { postJudge } from './judge';
|
||||
import {
|
||||
ContestNotFoundError, PermissionError, ProblemNotFoundError,
|
||||
RecordNotFoundError, UserNotFoundError,
|
||||
@@ -150,10 +151,11 @@ class RecordDetailHandler extends Handler {
|
||||
status: 9, score: 0, time: 0, memory: 0, message: 'score canceled',
|
||||
}],
|
||||
};
|
||||
await Promise.all([
|
||||
const [latest] = await Promise.all([
|
||||
record.update(domainId, rid, $set),
|
||||
bus.emit('record/change', rdoc, $set),
|
||||
]);
|
||||
await postJudge(latest);
|
||||
}
|
||||
this.back();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user