core: typo fix

This commit is contained in:
undefined committed 2021-08-07 12:20:03 +08:00
1 parent c3190551dd
commit 77c4f6dd27
7 files changed
+17 -17

No files matched your search

+4 -4
View File
@@ -113,9 +113,9 @@ export class ContestBoardcastHandler extends Handler {
['Hydro', 'homepage'], ['Hydro', 'homepage'],
['contest_main', 'contest_main'], ['contest_main', 'contest_main'],
[tdoc.title, 'contest_detail', { tid }, true], [tdoc.title, 'contest_detail', { tid }, true],
['contest_boardcast'], ['contest_broadcast'],
]; ];
this.response.template = 'contest_boardcast.html'; this.response.template = 'contest_broadcast.html';
this.response.body = path; this.response.body = path;
} }
@@ -372,7 +372,7 @@ export class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
contest.updateStatus(domainId, tid, this.user._id, rid, pid), contest.updateStatus(domainId, tid, this.user._id, rid, pid),
]); ]);
} }
bus.boardcast('record/change', rdoc); bus.broadcast('record/change', rdoc);
if (!pretest && !contest.canShowSelfRecord.call(this, this.tdoc)) { if (!pretest && !contest.canShowSelfRecord.call(this, this.tdoc)) {
this.response.body = { tid }; this.response.body = { tid };
this.response.redirect = this.url('contest_detail', { tid }); this.response.redirect = this.url('contest_detail', { tid });
@@ -415,7 +415,7 @@ export async function apply() {
Route('contest_create', '/contest/create', ContestEditHandler); Route('contest_create', '/contest/create', ContestEditHandler);
Route('contest_main', '/contest', ContestListHandler, PERM.PERM_VIEW_CONTEST); Route('contest_main', '/contest', ContestListHandler, PERM.PERM_VIEW_CONTEST);
Route('contest_detail', '/contest/:tid', ContestDetailHandler, PERM.PERM_VIEW_CONTEST); Route('contest_detail', '/contest/:tid', ContestDetailHandler, PERM.PERM_VIEW_CONTEST);
Route('contest_boardcast', '/contest/:tid/boardcast', ContestBoardcastHandler); Route('contest_broadcast', '/contest/:tid/broadcast', ContestBoardcastHandler);
Route('contest_edit', '/contest/:tid/edit', ContestEditHandler, PERM.PERM_VIEW_CONTEST); Route('contest_edit', '/contest/:tid/edit', ContestEditHandler, PERM.PERM_VIEW_CONTEST);
Route('contest_scoreboard', '/contest/:tid/scoreboard', ContestScoreboardHandler, PERM.PERM_VIEW_CONTEST); Route('contest_scoreboard', '/contest/:tid/scoreboard', ContestScoreboardHandler, PERM.PERM_VIEW_CONTEST);
Route('contest_scoreboard_download', '/contest/:tid/export/:ext', ContestScoreboardDownloadHandler, PERM.PERM_VIEW_CONTEST); Route('contest_scoreboard_download', '/contest/:tid/export/:ext', ContestScoreboardDownloadHandler, PERM.PERM_VIEW_CONTEST);
+1 -1
View File
@@ -240,7 +240,7 @@ class HomeworkDetailProblemSubmitHandler extends HomeworkDetailProblemHandler {
rid, pid, false, 0, document.TYPE_HOMEWORK), rid, pid, false, 0, document.TYPE_HOMEWORK),
]); ]);
} }
bus.boardcast('record/change', rdoc); bus.broadcast('record/change', rdoc);
this.response.body.tid = tid; this.response.body.tid = tid;
this.response.body.rid = rid; this.response.body.rid = rid;
if (pretest || contest.canShowSelfRecord.call(this, this.tdoc)) this.response.redirect = this.url('record_detail', { rid }); if (pretest || contest.canShowSelfRecord.call(this, this.tdoc)) this.response.redirect = this.url('record_detail', { rid });
+3 -3
View File
@@ -72,7 +72,7 @@ export async function next(body: JudgeResultBody) {
if (body.memory !== undefined) $set.memory = body.memory; if (body.memory !== undefined) $set.memory = body.memory;
if (body.progress !== undefined) $set.progress = body.progress; if (body.progress !== undefined) $set.progress = body.progress;
rdoc = await record.update(rdoc.domainId, body.rid, $set, $push); rdoc = await record.update(rdoc.domainId, body.rid, $set, $push);
bus.boardcast('record/change', rdoc, $set, $push); bus.broadcast('record/change', rdoc, $set, $push);
} }
export async function end(body: JudgeResultBody) { export async function end(body: JudgeResultBody) {
@@ -98,7 +98,7 @@ export async function end(body: JudgeResultBody) {
await sleep(100); // Make sure that all 'next' event already triggered await sleep(100); // Make sure that all 'next' event already triggered
rdoc = await record.update(rdoc.domainId, body.rid, $set, $push, $unset); rdoc = await record.update(rdoc.domainId, body.rid, $set, $push, $unset);
await postJudge(rdoc); await postJudge(rdoc);
bus.boardcast('record/change', rdoc); // trigger a full update bus.broadcast('record/change', rdoc); // trigger a full update
} }
export class JudgeFilesDownloadHandler extends Handler { export class JudgeFilesDownloadHandler extends Handler {
@@ -153,7 +153,7 @@ class JudgeConnectionHandler extends ConnectionHandler {
this.processing = t; this.processing = t;
const $set = { status: builtin.STATUS.STATUS_FETCHED }; const $set = { status: builtin.STATUS.STATUS_FETCHED };
const rdoc = await record.update(t.domainId, t.rid, $set, {}); const rdoc = await record.update(t.domainId, t.rid, $set, {});
bus.boardcast('record/change', rdoc, $set, {}); bus.broadcast('record/change', rdoc, $set, {});
} }
async message(msg) { async message(msg) {
+2 -2
View File
@@ -267,7 +267,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
domain.incUserInDomain(domainId, this.user._id, 'nSubmit'), domain.incUserInDomain(domainId, this.user._id, 'nSubmit'),
]); ]);
} }
bus.boardcast('record/change', rdoc); bus.broadcast('record/change', rdoc);
this.response.body = { rid }; this.response.body = { rid };
this.response.redirect = this.url('record_detail', { rid }); this.response.redirect = this.url('record_detail', { rid });
} }
@@ -284,7 +284,7 @@ export class ProblemPretestHandler extends ProblemDetailHandler {
lang, code, true, input, lang, code, true, input,
); );
const rdoc = await record.get(domainId, rid); const rdoc = await record.get(domainId, rid);
bus.boardcast('record/change', rdoc); bus.broadcast('record/change', rdoc);
this.response.body = { rid }; this.response.body = { rid };
} }
} }
+1 -1
View File
@@ -22,7 +22,7 @@ class MessageModel {
const mdoc = { const mdoc = {
from, to, content, _id: res.insertedId, flag, from, to, content, _id: res.insertedId, flag,
}; };
if (from !== to) bus.boardcast('user/message', to, mdoc); if (from !== to) bus.broadcast('user/message', to, mdoc);
await user.inc(to, 'unreadMsg', 1); await user.inc(to, 'unreadMsg', 1);
return mdoc; return mdoc;
} }
+4 -4
View File
@@ -36,10 +36,10 @@ export function getMany(keys: string[]): any[] {
return keys.map((key) => cache[key]); return keys.map((key) => cache[key]);
} }
export async function set<K extends keyof SystemKeys>(_id: K, value: SystemKeys[K], boardcast?: boolean): Promise<SystemKeys[K]>; export async function set<K extends keyof SystemKeys>(_id: K, value: SystemKeys[K], broadcast?: boolean): Promise<SystemKeys[K]>;
export async function set<K>(_id: string, value: K, boardcast?: boolean): Promise<K>; export async function set<K>(_id: string, value: K, broadcast?: boolean): Promise<K>;
export async function set(_id: string, value: any, boardcast = true) { export async function set(_id: string, value: any, broadcast = true) {
if (boardcast) bus.boardcast('system/setting', { [_id]: value }); if (broadcast) bus.broadcast('system/setting', { [_id]: value });
const res = await coll.findOneAndUpdate( const res = await coll.findOneAndUpdate(
{ _id }, { _id },
{ $set: { value } }, { $set: { value } },
+2 -2
View File
@@ -184,7 +184,7 @@ export async function bail<K extends keyof EventMap>(name: K, ...args: Parameter
return null; return null;
} }
export function boardcast<K extends keyof EventMap>(event: K, ...payload: Parameters<EventMap[K]>) { export function broadcast<K extends keyof EventMap>(event: K, ...payload: Parameters<EventMap[K]>) {
// Process forked by pm2 would also have process.send // Process forked by pm2 would also have process.send
if (process.send && !cluster.isMaster) { if (process.send && !cluster.isMaster) {
process.send({ process.send({
@@ -217,5 +217,5 @@ process.on('message', messageHandler);
cluster.on('message', messageHandler); cluster.on('message', messageHandler);
global.Hydro.service.bus = { global.Hydro.service.bus = {
addListener, bail, boardcast, emit, on, off, once, parallel, prependListener, removeListener, serial, addListener, bail, broadcast, emit, on, off, once, parallel, prependListener, removeListener, serial,
}; };