mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
judge: provide score & subtaskId
This commit is contained in:
1 parent
60aa0e1611
commit
a585c13a72
19 files changed
+118
-186
No files matched your search
@@ -41,19 +41,19 @@ export async function postJudge(rdoc: RecordDoc) {
|
||||
await bus.serial('record/judge', rdoc, updated);
|
||||
}
|
||||
|
||||
export async function next(body: JudgeResultBody) {
|
||||
export async function next(body: Partial<JudgeResultBody>) {
|
||||
body.rid = new ObjectID(body.rid);
|
||||
let rdoc = await record.get(body.rid);
|
||||
if (!rdoc) return;
|
||||
const $set: Partial<RecordDoc> = {};
|
||||
const $push: any = {};
|
||||
if (body.case) {
|
||||
const c: TestCase = {
|
||||
const c: Required<TestCase> = {
|
||||
...body.case,
|
||||
id: body.case.id || 0,
|
||||
memory: body.case.memory,
|
||||
time: body.case.time,
|
||||
subtaskId: body.case.subtaskId || 0,
|
||||
score: body.case.score || 0,
|
||||
message: body.case.message || '',
|
||||
status: body.case.status,
|
||||
};
|
||||
rdoc.testCases.push(c);
|
||||
$push.testCases = c;
|
||||
@@ -75,7 +75,7 @@ export async function next(body: JudgeResultBody) {
|
||||
bus.broadcast('record/change', rdoc!, $set, $push);
|
||||
}
|
||||
|
||||
export async function end(body: JudgeResultBody) {
|
||||
export async function end(body: Partial<JudgeResultBody>) {
|
||||
if (body.rid) body.rid = new ObjectID(body.rid);
|
||||
let rdoc = await record.get(body.rid);
|
||||
if (!rdoc) return;
|
||||
|
||||
@@ -289,7 +289,6 @@ export class ProblemRandomHandler extends ProblemHandler {
|
||||
const category = flattenDeep(decodeURIComponent(qs).split(' ')
|
||||
.filter((i) => i.startsWith('category:'))
|
||||
.map((i) => i.split('category:')[1]?.split(',')));
|
||||
console.log(qs, category);
|
||||
const q = buildQuery(this.user);
|
||||
if (category.length) q.$and = category.map((tag) => ({ tag }));
|
||||
await bus.serial('problem/list', q, this);
|
||||
|
||||
@@ -183,7 +183,7 @@ class RecordDetailHandler extends Handler {
|
||||
time: 0,
|
||||
memory: 0,
|
||||
testCases: [{
|
||||
status: 9, score: 0, time: 0, memory: 0, message: 'score canceled',
|
||||
id: 0, subtaskId: 0, status: 9, score: 0, time: 0, memory: 0, message: 'score canceled',
|
||||
}],
|
||||
};
|
||||
const [latest] = await Promise.all([
|
||||
|
||||
Reference in new issue
Block a user