core: fix ProblemDetail.get

This commit is contained in:
undefined committed 2020-09-17 00:01:01 +08:00
1 parent e5ed861f1b
commit 15d2ecaf54
4 files changed
+10 -5

No files matched your search

+2 -2
View File
@@ -19,8 +19,8 @@ dist/
globalConfig.json globalConfig.json
# Config Files # Config Files
config.yaml /config.yaml
config.json /config.json
yarn.lock yarn.lock
tsconfig.json tsconfig.json
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.13.12", "version": "2.13.13",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "dist/loader.js", "main": "dist/loader.js",
"typings": "dist/loader.d.ts", "typings": "dist/loader.d.ts",
+6 -2
View File
@@ -189,6 +189,8 @@ class ProblemDetailHandler extends ProblemHandler {
}; };
} }
async get(...args: any[]) { } // eslint-disable-line
@param('pid', Types.UnsignedInt) @param('pid', Types.UnsignedInt)
@param('dest', Types.String) @param('dest', Types.String)
@param('hidden', Types.Boolean) @param('hidden', Types.Boolean)
@@ -391,9 +393,11 @@ class ProblemSettingsHandler extends ProblemManageHandler {
} }
if (!difficultyAdmin) difficultyAdmin = null; if (!difficultyAdmin) difficultyAdmin = null;
else if (difficultyAdmin < 1 || difficultyAdmin > 9) throw new ValidationError('difficultyAdmin'); else if (difficultyAdmin < 1 || difficultyAdmin > 9) throw new ValidationError('difficultyAdmin');
await problem.edit(domainId, pdoc.docId, { const update: Partial<Pdoc> = {
hidden, category, tag, difficultySetting, difficultyAdmin, hidden, category, tag, difficultySetting, difficultyAdmin,
}); };
await bus.serial('problem/setting', update, this);
await problem.edit(domainId, pdoc.docId, update);
await global.Hydro.script.difficulty.run({ domainId, pid }, console.log); await global.Hydro.script.difficulty.run({ domainId, pid }, console.log);
this.back(); this.back();
} }
+1
View File
@@ -43,6 +43,7 @@ export interface EventMap {
'problem/edit': (doc: Pdoc) => VoidReturn 'problem/edit': (doc: Pdoc) => VoidReturn
'problem/list': (query: FilterQuery<Pdoc>, handler: any) => VoidReturn 'problem/list': (query: FilterQuery<Pdoc>, handler: any) => VoidReturn
'problem/setting': (update: Partial<Pdoc>, handler: any) => VoidReturn
'problem/get': (doc: Pdoc, handler: any) => VoidReturn 'problem/get': (doc: Pdoc, handler: any) => VoidReturn
'record/change': (rdoc: Rdoc, $set?: any, $push?: any) => void 'record/change': (rdoc: Rdoc, $set?: any, $push?: any) => void