core&ui: allow admin view contest when its not started

This commit is contained in:
undefined committed 2022-07-29 16:14:47 +08:00
1 parent b7f0e59e5d
commit ba0beee9a8
6 files changed
+29 -15

No files matched your search

+5 -1
View File
@@ -121,12 +121,16 @@ export class ContestDetailHandler extends ContestDetailBaseHandler {
this.response.body = {
tdoc: this.tdoc, tsdoc: this.tsdoc, udict,
};
if (contest.isNotStarted(this.tdoc)) return;
if (!this.request.json) {
this.response.body.tdoc.content = this.response.body.tdoc.content
.replace(/\(file:\/\//g, `(./${this.tdoc.docId}/file/`)
.replace(/="file:\/\//g, `="./${this.tdoc.docId}/file/`);
}
if (
(contest.isNotStarted(this.tdoc) || !this.tsdoc?.attend)
&& !this.user.own(this.tdoc)
&& !this.user.hasPerm(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD)
) return;
const pdict = await problem.getList(domainId, this.tdoc.pids, true, undefined, undefined, problem.PROJECTION_CONTEST_LIST);
const psdict = {};
let rdict = {};
+6 -4
View File
@@ -73,7 +73,11 @@ class HomeworkDetailHandler extends Handler {
this.response.body = {
tdoc, tsdoc, udict, ddocs, page, dpcount, dcount,
};
if (contest.isNotStarted(tdoc)) return;
if (
(contest.isNotStarted(tdoc) || !tsdoc?.attend)
&& !this.user.own(tdoc)
&& !this.user.hasPerm(PERM.PERM_VIEW_HOMEWORK_HIDDEN_SCOREBOARD)
) return;
const pdict = await problem.getList(domainId, tdoc.pids, true, undefined, undefined, problem.PROJECTION_CONTEST_LIST);
const psdict = {};
let rdict = {};
@@ -93,9 +97,7 @@ class HomeworkDetailHandler extends Handler {
);
}
}
this.response.body.pdict = pdict;
this.response.body.psdict = psdict;
this.response.body.rdict = rdict;
Object.assign(this.response.body, { pdict, psdict, rdict });
}
@param('tid', Types.ObjectID)