mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
修复在线IDE
This commit is contained in:
1 parent
b1153b641a
commit
61cba6f180
12 files changed
+94
-76
No files matched your search
@@ -13,9 +13,9 @@ function getMultiStatus(query) {
|
||||
return collStatus.find(query);
|
||||
}
|
||||
async function getListStatus(uid, tids) {
|
||||
const psdocs = await getMultiStatus({ uid, pid: { $in: Array.from(new Set(tids)) } }).toArray();
|
||||
const tsdocs = await getMultiStatus({ uid, tid: { $in: Array.from(new Set(tids)) } }).toArray();
|
||||
const r = {};
|
||||
for (const psdoc of psdocs) r[psdoc.pid] = psdoc;
|
||||
for (const tsdoc of tsdocs) r[tsdoc.pid] = tsdoc;
|
||||
return r;
|
||||
}
|
||||
async function enroll(tid, uid) {
|
||||
@@ -104,6 +104,12 @@ module.exports = {
|
||||
if (!tdoc) throw new TrainingNotFoundError(tid);
|
||||
return tdoc;
|
||||
},
|
||||
async getList(tids) {
|
||||
const tdocs = await this.getMulti({ _id: { $in: Array.from(new Set(tids)) } }).toArray();
|
||||
const r = {};
|
||||
for (const tdoc of tdocs) r[tdoc._id] = tdoc;
|
||||
return r;
|
||||
},
|
||||
getMulti: (query) => coll.find(query),
|
||||
getMultiStatus,
|
||||
getStatus,
|
||||
|
||||
Reference in new issue
Block a user