ui: enhance problem_files page

This commit is contained in:
undefined committed 2022-02-08 18:26:34 +08:00
1 parent 1acd2ff0bb
commit 9158550139
5 files changed
+25 -23

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.4.8",
"version": "3.4.9",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+6 -3
View File
@@ -291,11 +291,14 @@ export class ProblemDetailHandler extends ProblemHandler {
this.tdoc = await contest.get(domainId, tid);
if (!this.tdoc) throw new ContestNotFoundError(domainId, tid);
this.tsdoc = await contest.getStatus(domainId, tid, this.user._id);
this.pdoc.tag.length = 0;
const showAccept = contest.canShowScoreboard.call(this, this.tdoc, true);
if (!showAccept) this.pdoc.nAccept = 0;
if (contest.isNotStarted(this.tdoc)) throw new ContestNotLiveError(tid);
if (!contest.isDone(this.tdoc) && !this.tsdoc?.attend) throw new ContestNotAttendedError(tid);
this.pdoc.tag.length = 0;
if (!contest.canShowScoreboard(this.tdoc) || !contest.isLocked(this.tdoc)) {
delete this.pdoc.nAccept;
delete this.pdoc.nSubmit;
delete this.pdoc.stats;
}
} else if (!problem.canViewBy(this.pdoc, this.user)) {
throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN);
}