mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: add contest/scoreboard hook
This commit is contained in:
1 parent
0134a4be8c
commit
fc1f703e21
2 files changed
+8
-6
No files matched your search
@@ -500,7 +500,7 @@ function _getStatusJournal(tsdoc) {
|
||||
export async function add(
|
||||
domainId: string, title: string, content: string, owner: number,
|
||||
rule: string, beginAt = new Date(), endAt = new Date(), pids: number[] = [],
|
||||
rated = false, data: Partial<Tdoc> = {},
|
||||
rated = false, data: Partial<Tdoc<30>> = {},
|
||||
) {
|
||||
if (!RULES[rule]) throw new ValidationError('rule');
|
||||
if (beginAt >= endAt) throw new ValidationError('beginAt', 'endAt');
|
||||
@@ -698,7 +698,7 @@ export function canShowScoreboard(tdoc: Tdoc<30>, allowPermOverride = true) {
|
||||
export async function getScoreboard(
|
||||
this: Handler, domainId: string, tid: ObjectID,
|
||||
isExport = false, ignoreLock = false,
|
||||
): Promise<[Tdoc<30 | 60>, ScoreboardRow[], Udict, ProblemDict]> {
|
||||
): Promise<[Tdoc<30>, ScoreboardRow[], Udict, ProblemDict]> {
|
||||
const tdoc = await get(domainId, tid);
|
||||
if (!canShowScoreboard.call(this, tdoc)) throw new ContestScoreboardHiddenError(tid);
|
||||
if (ignoreLock) delete tdoc.lockAt;
|
||||
@@ -708,6 +708,7 @@ export async function getScoreboard(
|
||||
isExport, this.translate.bind(this),
|
||||
tdoc, pdict, tsdocsCursor,
|
||||
);
|
||||
await bus.parallel('contest/scoreboard', tdoc, rows, udict, pdict);
|
||||
return [tdoc, rows, udict, pdict];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import type { ProblemSolutionHandler } from '../handler/problem';
|
||||
import type { UserRegisterHandler } from '../handler/user';
|
||||
import type {
|
||||
DiscussionDoc, DomainDoc, FileInfo,
|
||||
MessageDoc, ProblemDoc, RecordDoc,
|
||||
Tdoc, TrainingDoc, User,
|
||||
MessageDoc, ProblemDict, ProblemDoc, RecordDoc,
|
||||
ScoreboardRow, Tdoc, TrainingDoc, Udict, User,
|
||||
} from '../interface';
|
||||
import type { DocType } from '../model/document';
|
||||
import type { ConnectionHandler, Handler } from './server';
|
||||
@@ -86,8 +86,9 @@ export interface EventMap extends LifecycleEvents, HandlerEvents {
|
||||
'problem/addAdditionalFile': (domainId: string, docId: number, name: string, payload: Omit<FileInfo, '_id'>) => VoidReturn
|
||||
'problem/delAdditionalFile': (domainId: string, docId: number, name: string[]) => VoidReturn
|
||||
|
||||
'contest/before-add': (payload: Partial<Tdoc>) => VoidReturn
|
||||
'contest/add': (payload: Partial<Tdoc>, id: ObjectID) => VoidReturn
|
||||
'contest/before-add': (payload: Partial<Tdoc<30>>) => VoidReturn
|
||||
'contest/add': (payload: Partial<Tdoc<30>>, id: ObjectID) => VoidReturn
|
||||
'contest/scoreboard': (tdoc: Tdoc<30>, rows: ScoreboardRow[], udict: Udict, pdict: ProblemDict) => VoidReturn
|
||||
|
||||
'oplog/log': (type: string, handler: Handler, args: any, data: any) => VoidReturn;
|
||||
|
||||
|
||||
Reference in new issue
Block a user