mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix training.getListStatus
This commit is contained in:
1 parent
0c51e7d5f6
commit
151cc79f36
3 files changed
+5
-4
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.13.60",
|
"version": "2.13.61",
|
||||||
"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",
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ String.prototype.rawformat = function rawFormat(object) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
String.prototype.translate = function translate(...languages: string[]) {
|
String.prototype.translate = function translate(...languages: string[]) {
|
||||||
if (languages.length === 0) languages = ['zh_CN'];
|
if (!languages.length) languages = ['zh_CN'];
|
||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
|
if (!language) continue;
|
||||||
if (locales[language]) {
|
if (locales[language]) {
|
||||||
if (locales[language][this] !== undefined) return locales[language][this];
|
if (locales[language][this] !== undefined) return locales[language][this];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ export function getMultiStatus(domainId: string, query: FilterQuery<TrainingDoc>
|
|||||||
|
|
||||||
export async function getListStatus(domainId: string, uid: number, tids: ObjectID[]) {
|
export async function getListStatus(domainId: string, uid: number, tids: ObjectID[]) {
|
||||||
const tsdocs = await getMultiStatus(
|
const tsdocs = await getMultiStatus(
|
||||||
domainId, { uid, tid: { $in: Array.from(new Set(tids)) } },
|
domainId, { uid, docId: { $in: Array.from(new Set(tids)) } },
|
||||||
).toArray();
|
).toArray();
|
||||||
const r = {};
|
const r = {};
|
||||||
for (const tsdoc of tsdocs) r[tsdoc.pid] = tsdoc;
|
for (const tsdoc of tsdocs) r[tsdoc.docId] = tsdoc;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user