From 15d6b61b4dac4440e88f48fcf039e252c0bef530 Mon Sep 17 00:00:00 2001 From: Menci Date: Sat, 1 Jul 2017 19:41:18 +0800 Subject: [PATCH] Fix invalid type when modify contest --- modules/contest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/contest.js b/modules/contest.js index 2ef4439..e828188 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -91,6 +91,7 @@ app.post('/contest/:id/edit', async (req, res) => { contest.ranklist_id = ranklist.id; // Only new contest can be set type + if (!['noi', 'ioi', 'acm'].includes(req.body.type)) throw new ErrorMessage('无效的赛制。'); contest.type = req.body.type; } @@ -99,7 +100,6 @@ app.post('/contest/:id/edit', async (req, res) => { contest.subtitle = req.body.subtitle; if (!Array.isArray(req.body.problems)) req.body.problems = [req.body.problems]; contest.problems = req.body.problems.join('|'); - if (!['noi', 'ioi', 'acm'].includes(req.body.type)) throw new ErrorMessage('无效的赛制。'); contest.information = req.body.information; contest.start_time = syzoj.utils.parseDate(req.body.start_time); contest.end_time = syzoj.utils.parseDate(req.body.end_time);