From 6da6c43a5329fdc1cc32c5d7e1bf9d8446cd4fa9 Mon Sep 17 00:00:00 2001 From: Menci Date: Fri, 16 Jun 2017 22:29:23 +0800 Subject: [PATCH] Fix submit after contest --- modules/problem.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/problem.js b/modules/problem.js index 616ffd7..952f6e7 100644 --- a/modules/problem.js +++ b/modules/problem.js @@ -542,6 +542,7 @@ app.post('/problem/:id/submit', async (req, res) => { if (contest_id) { let contest = await Contest.fromID(contest_id); if (!contest) throw new ErrorMessage('无此比赛。'); + if (!await contest.isRunning()) throw new ErrorMessage('比赛未开始或已结束。'); let problems_id = await contest.getProblems(); if (!problems_id.includes(id)) throw new ErrorMessage('无此题目。');