core: judge: ensure judge event key

This commit is contained in:
undefined committed 2025-12-31 10:17:41 +08:00
1 parent 907de9c37f
commit 5161670cb8
1 file changed
+4
+4
View File
@@ -99,6 +99,7 @@ export class JudgeResultCallbackContext {
}, { upsert: true }); }, { upsert: true });
} else { } else {
const rdoc = await record.update(this.task.domainId, new ObjectId(this.task.rid as string), $set, $push, $unset, $inc); const rdoc = await record.update(this.task.domainId, new ObjectId(this.task.rid as string), $set, $push, $unset, $inc);
body.key = 'next';
if (rdoc) this.ctx.broadcast('record/change', rdoc, $set, $push, body); if (rdoc) this.ctx.broadcast('record/change', rdoc, $set, $push, body);
} }
} }
@@ -107,6 +108,7 @@ export class JudgeResultCallbackContext {
const { const {
$set, $push, $unset, $inc, $set, $push, $unset, $inc,
} = processPayload(body); } = processPayload(body);
body.key = 'next';
const rdoc = await record.update(domainId, rid, $set, $push, $unset, $inc); const rdoc = await record.update(domainId, rid, $set, $push, $unset, $inc);
if (rdoc) app.broadcast('record/change', rdoc, $set, $push, body); if (rdoc) app.broadcast('record/change', rdoc, $set, $push, body);
} }
@@ -156,6 +158,7 @@ export class JudgeResultCallbackContext {
const rdoc = await record.update(this.task.domainId, new ObjectId(this.task.rid as string), $set, $push, $unset); const rdoc = await record.update(this.task.domainId, new ObjectId(this.task.rid as string), $set, $push, $unset);
if (rdoc) { if (rdoc) {
body.key = 'end';
bus.broadcast('record/change', rdoc, null, null, body); // trigger a full update bus.broadcast('record/change', rdoc, null, null, body); // trigger a full update
await JudgeResultCallbackContext.postJudge(rdoc, this); await JudgeResultCallbackContext.postJudge(rdoc, this);
} }
@@ -169,6 +172,7 @@ export class JudgeResultCallbackContext {
$set.judger = body.judger ?? 1; $set.judger = body.judger ?? 1;
const rdoc = await record.update(domainId, rid, $set, $push, $unset); const rdoc = await record.update(domainId, rid, $set, $push, $unset);
if (rdoc) { if (rdoc) {
body.key = 'end';
app.broadcast('record/change', rdoc, null, null, body); // trigger a full update app.broadcast('record/change', rdoc, null, null, body); // trigger a full update
await JudgeResultCallbackContext.postJudge(rdoc); await JudgeResultCallbackContext.postJudge(rdoc);
} }