Skip to content

Commit 19d278f

Browse files
committed
core: hide problem status for hidden training problem
1 parent 642662f commit 19d278f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/hydrooj/src/handler/training.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,17 @@ class TrainingDetailHandler extends Handler {
111111
shouldCompare = uid !== this.user._id;
112112
} else uid = this.user._id;
113113
const canViewHidden = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id;
114-
const [udoc, udict, pdict, psdict, selfPsdict] = await Promise.all([
114+
const [udoc, udict, pdict] = await Promise.all([
115115
user.getById(domainId, tdoc.owner),
116116
user.getListForRender(domainId, enrollUsers, this.user.hasPerm(PERM.PERM_VIEW_USER_PRIVATE_INFO)),
117117
problem.getList(domainId, pids, canViewHidden, false),
118-
problem.getListStatus(domainId, uid, pids),
119-
shouldCompare ? problem.getListStatus(domainId, this.user._id, pids) : {},
120118
]);
121119
const missing = pids.filter((pid) => !pdict[pid]?.docId);
120+
const exist = pids.filter((pid) => pdict[pid]?.docId);
121+
const [psdict, selfPsdict] = await Promise.all([
122+
problem.getListStatus(domainId, uid, exist),
123+
shouldCompare ? problem.getListStatus(domainId, this.user._id, exist) : {},
124+
]);
122125
const donePids = new Set<number>();
123126
const progPids = new Set<number>();
124127
for (const pid in psdict) {

0 commit comments

Comments
 (0)