core&ui: allow missing problem in training (fix #542)

This commit is contained in:
undefined committed 2025-12-05 18:31:56 +08:00
1 parent 0fb7222ddf
commit 242fa35500
3 files changed
+10 -2

No files matched your search

+3 -2
View File
@@ -112,10 +112,11 @@ class TrainingDetailHandler extends Handler {
const [udoc, udict, pdict, psdict, selfPsdict] = await Promise.all([
user.getById(domainId, tdoc.owner),
user.getListForRender(domainId, enrollUsers, this.user.hasPerm(PERM.PERM_VIEW_USER_PRIVATE_INFO)),
problem.getList(domainId, pids, canViewHidden, true),
problem.getList(domainId, pids, canViewHidden, false),
problem.getListStatus(domainId, uid, pids),
shouldCompare ? problem.getListStatus(domainId, this.user._id, pids) : {},
]);
const missing = pids.filter((pid) => !pdict[pid]?.docId);
const donePids = new Set<number>();
const progPids = new Set<number>();
for (const pid in psdict) {
@@ -151,7 +152,7 @@ class TrainingDetailHandler extends Handler {
const groups = this.user.hasPerm(PERM.PERM_EDIT_DOMAIN)
? await user.listGroup(domainId) : [];
this.response.body = {
tdoc, tsdoc, pids, pdict, psdict, ndict, nsdict, udoc, udict, selfPsdict, groups,
tdoc, tsdoc, pids, pdict, psdict, ndict, nsdict, udoc, udict, selfPsdict, groups, missing,
};
this.response.body.tdoc.description = this.response.body.tdoc.description
.replace(/\(file:\/\//g, `(./${tdoc.docId}/file/`)
+1
View File
@@ -892,6 +892,7 @@ Solutions Liked: 题解被赞
Solutions: 题解
Solve: 解决
Solved: 解决
Some problems in the training are missing or you do not have permission to view them.: 训练中某些题目缺失或您没有权限查看。
Sorry, there are no problems in the problem set.: 题库中没有题目
Sorry, there are no training plans.: 目前没有训练计划。
Sorry, there are no users in this domain.: 对不起,此域中没有用户。
@@ -55,6 +55,12 @@
<p>{{ _('page.training_detail.invalid_when_not_enrolled') }}</p>
</blockquote>
{% endif %}
{% if missing.length %}
<blockquote class="warn">
<p>{{ _('Some problems in the training are missing or you do not have permission to view them.') }}</p>
<p>{{ missing|join(', ') }}</p>
</blockquote>
{% endif %}
{{ tdoc.description|default('')|markdown|safe }}
</div>
</div>