core: add contest ongoing check

This commit is contained in:
undefined committed 2021-11-27 15:25:55 +08:00
1 parent c07bf9a845
commit 44bc0185be
2 files changed
+6 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.1.38",
"version": "3.1.39",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+5 -1
View File
@@ -380,8 +380,12 @@ export class ProblemDetailHandler extends ProblemHandler {
}
export class ProblemSubmitHandler extends ProblemDetailHandler {
async get(domainId: string, tid?: ObjectID) {
@param('tid', Types.ObjectID, true)
async prepare(domainId: string, tid?: ObjectID) {
if (tid && !contest.isOngoing(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
}
async get() {
this.response.template = 'problem_submit.html';
this.response.body = {
pdoc: this.pdoc,