diff --git a/modules/contest.js b/modules/contest.js index ca1beed..2ef4439 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -89,6 +89,9 @@ app.post('/contest/:id/edit', async (req, res) => { let ranklist = await ContestRanklist.create(); await ranklist.save(); contest.ranklist_id = ranklist.id; + + // Only new contest can be set type + contest.type = req.body.type; } if (!req.body.title.trim()) throw new ErrorMessage('比赛名不能为空。'); @@ -97,7 +100,6 @@ app.post('/contest/:id/edit', async (req, res) => { 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.type = req.body.type; 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); diff --git a/views/contest_edit.ejs b/views/contest_edit.ejs index b0118c4..e1cd562 100644 --- a/views/contest_edit.ejs +++ b/views/contest_edit.ejs @@ -22,19 +22,19 @@