core: 优化比赛模块鉴权(比赛结束时可自由查看题目)

This commit is contained in:
undefined committed 2020-11-14 13:00:16 +08:00
1 parent 99e0d2fb14
commit c1da60a37e
4 files changed
+5 -4

No files matched your search

+2 -1
View File
@@ -241,7 +241,7 @@ class ContestProblemHandler extends ContestHandler {
]);
this.attended = this.tsdoc && this.tsdoc.attend === 1;
this.response.template = 'problem_detail.html';
if (contest.isDone(this.tdoc)) {
if (!contest.isDone(this.tdoc)) {
if (!this.attended) throw new ContestNotAttendedError(this.tdoc.docId);
if (contest.isNotStarted(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
}
@@ -272,6 +272,7 @@ class ContestProblemSubmitHandler extends ContestProblemHandler {
@param('tid', Types.ObjectID)
@param('pid', Types.UnsignedInt)
async prepare(domainId: string, tid: ObjectID, pid: number) {
if (contest.isOngoing(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
let rdocs = [];
if (this.canShowRecord(this.tdoc)) {
rdocs = await record.getUserInProblemMulti(