mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
judge: bug fix
This commit is contained in:
1 parent
bba42d5936
commit
d29bd22249
3 files changed
+6
-8
No files matched your search
@@ -992,12 +992,10 @@ export class ProblemCreateHandler extends Handler {
|
||||
export class ProblemPrefixListHandler extends Handler {
|
||||
@param('prefix', Types.Name)
|
||||
async get(domainId: string, prefix: string) {
|
||||
const pdocs = await problem.getPrefixList(domainId, prefix);
|
||||
if (!Number.isNaN(+prefix) && !pdocs.filter((i) => i.docId === +prefix)) {
|
||||
const pdoc = await problem.get(domainId, +prefix, ['domainId', 'docId', 'pid', 'title']);
|
||||
if (pdoc) pdocs.unshift(pdoc);
|
||||
}
|
||||
const pdoc = await problem.get(domainId, prefix, ['domainId', 'docId', 'pid', 'title']);
|
||||
const [pdocs, pdoc] = await Promise.all([
|
||||
problem.getPrefixList(domainId, prefix),
|
||||
problem.get(domainId, Number.isSafeInteger(+prefix) ? +prefix : prefix, ['domainId', 'docId', 'pid', 'title']),
|
||||
]);
|
||||
if (pdoc) pdocs.unshift(pdoc);
|
||||
if (pdocs.length < 20) {
|
||||
const search = global.Hydro.lib.problemSearch || defaultSearch;
|
||||
|
||||
Reference in new issue
Block a user