Skip to content

Commit 5161670

Browse files
committed
core: judge: ensure judge event key
1 parent 907de9c commit 5161670

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/hydrooj/src/handler/judge.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export class JudgeResultCallbackContext {
9999
}, { upsert: true });
100100
} else {
101101
const rdoc = await record.update(this.task.domainId, new ObjectId(this.task.rid as string), $set, $push, $unset, $inc);
102+
body.key = 'next';
102103
if (rdoc) this.ctx.broadcast('record/change', rdoc, $set, $push, body);
103104
}
104105
}
@@ -107,6 +108,7 @@ export class JudgeResultCallbackContext {
107108
const {
108109
$set, $push, $unset, $inc,
109110
} = processPayload(body);
111+
body.key = 'next';
110112
const rdoc = await record.update(domainId, rid, $set, $push, $unset, $inc);
111113
if (rdoc) app.broadcast('record/change', rdoc, $set, $push, body);
112114
}
@@ -156,6 +158,7 @@ export class JudgeResultCallbackContext {
156158

157159
const rdoc = await record.update(this.task.domainId, new ObjectId(this.task.rid as string), $set, $push, $unset);
158160
if (rdoc) {
161+
body.key = 'end';
159162
bus.broadcast('record/change', rdoc, null, null, body); // trigger a full update
160163
await JudgeResultCallbackContext.postJudge(rdoc, this);
161164
}
@@ -169,6 +172,7 @@ export class JudgeResultCallbackContext {
169172
$set.judger = body.judger ?? 1;
170173
const rdoc = await record.update(domainId, rid, $set, $push, $unset);
171174
if (rdoc) {
175+
body.key = 'end';
172176
app.broadcast('record/change', rdoc, null, null, body); // trigger a full update
173177
await JudgeResultCallbackContext.postJudge(rdoc);
174178
}

0 commit comments

Comments
 (0)