mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: problem: fix get without namespaces
This commit is contained in:
1 file changed
+1
-1
@@ -33,7 +33,7 @@ export interface ProblemDoc extends Document { }
|
|||||||
export type Field = keyof ProblemDoc;
|
export type Field = keyof ProblemDoc;
|
||||||
|
|
||||||
const logger = new Logger('problem');
|
const logger = new Logger('problem');
|
||||||
function sortable(source: string, namespaces: Record<string, string> = {}) {
|
function sortable(source: string, namespaces: Record<string, string>) {
|
||||||
const [namespace, pid] = source.includes('-') ? source.split('-') : ['default', source];
|
const [namespace, pid] = source.includes('-') ? source.split('-') : ['default', source];
|
||||||
return ((namespaces ? `${namespaces[namespace]}-` : '') + pid)
|
return ((namespaces ? `${namespaces[namespace]}-` : '') + pid)
|
||||||
.replace(/(\d+)/g, (str) => (str.length >= 6 ? str : ('0'.repeat(6 - str.length) + str)));
|
.replace(/(\d+)/g, (str) => (str.length >= 6 ? str : ('0'.repeat(6 - str.length) + str)));
|
||||||
|
|||||||
Reference in new issue
Block a user