mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: judge: emit optional raw payload
This commit is contained in:
2 files changed
+3
-3
No files matched your search
@@ -69,7 +69,7 @@ export async function next(body: Partial<JudgeResultBody>) {
|
||||
if (!rdoc) return;
|
||||
const { $set, $push } = processPayload(rdoc, body);
|
||||
rdoc = await record.update(rdoc.domainId, body.rid, $set, $push, {}, body.addProgress ? { progress: body.addProgress } : {});
|
||||
bus.broadcast('record/change', rdoc!, $set, $push);
|
||||
bus.broadcast('record/change', rdoc!, $set, $push, body);
|
||||
}
|
||||
|
||||
export async function postJudge(rdoc: RecordDoc) {
|
||||
@@ -139,7 +139,7 @@ export async function end(body: Partial<JudgeResultBody>) {
|
||||
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);
|
||||
bus.broadcast('record/change', rdoc); // trigger a full update
|
||||
bus.broadcast('record/change', rdoc, null, null, body); // trigger a full update
|
||||
}
|
||||
|
||||
export class JudgeFilesDownloadHandler extends Handler {
|
||||
|
||||
@@ -98,7 +98,7 @@ export interface EventMap extends LifecycleEvents, HandlerEvents {
|
||||
'training/list': (query: Filter<TrainingDoc>, handler: any) => VoidReturn
|
||||
'training/get': (tdoc: TrainingDoc, handler: any) => VoidReturn
|
||||
|
||||
'record/change': (rdoc: RecordDoc, $set?: any, $push?: any) => void
|
||||
'record/change': (rdoc: RecordDoc, $set?: any, $push?: any, body?: any) => void
|
||||
'record/judge': (rdoc: RecordDoc, updated: boolean) => VoidReturn
|
||||
}
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
Reference in new issue
Block a user