core: fix training.getListStatus

This commit is contained in:
undefined committed 2020-11-30 22:39:50 +08:00
1 parent 0c51e7d5f6
commit 151cc79f36
3 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.13.60",
"version": "2.13.61",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+2 -1
View File
@@ -43,8 +43,9 @@ String.prototype.rawformat = function rawFormat(object) {
};
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) {
if (!language) continue;
if (locales[language]) {
if (locales[language][this] !== undefined) return locales[language][this];
}
+2 -2
View File
@@ -14,10 +14,10 @@ export function getMultiStatus(domainId: string, query: FilterQuery<TrainingDoc>
export async function getListStatus(domainId: string, uid: number, tids: ObjectID[]) {
const tsdocs = await getMultiStatus(
domainId, { uid, tid: { $in: Array.from(new Set(tids)) } },
domainId, { uid, docId: { $in: Array.from(new Set(tids)) } },
).toArray();
const r = {};
for (const tsdoc of tsdocs) r[tsdoc.pid] = tsdoc;
for (const tsdoc of tsdocs) r[tsdoc.docId] = tsdoc;
return r;
}