|
|
@ -28,6 +28,8 @@ let ProblemTag = syzoj.model('problem_tag'); |
|
|
|
let ProblemTagMap = syzoj.model('problem_tag_map'); |
|
|
|
let ProblemTagMap = syzoj.model('problem_tag_map'); |
|
|
|
let Article = syzoj.model('article'); |
|
|
|
let Article = syzoj.model('article'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const judger = require('../modules/judge'); |
|
|
|
|
|
|
|
|
|
|
|
app.get('/problems', async (req, res) => { |
|
|
|
app.get('/problems', async (req, res) => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
let where = {}; |
|
|
|
let where = {}; |
|
|
@ -194,7 +196,7 @@ app.get('/problem/:id', async (req, res) => { |
|
|
|
problem.allowedManage = await problem.isAllowedManageBy(res.locals.user); |
|
|
|
problem.allowedManage = await problem.isAllowedManageBy(res.locals.user); |
|
|
|
|
|
|
|
|
|
|
|
if (problem.is_public || problem.allowedEdit) { |
|
|
|
if (problem.is_public || problem.allowedEdit) { |
|
|
|
await syzoj.utils.markdown(problem, [ 'description', 'input_format', 'output_format', 'example', 'limit_and_hint' ]); |
|
|
|
await syzoj.utils.markdown(problem, ['description', 'input_format', 'output_format', 'example', 'limit_and_hint']); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new ErrorMessage('您没有权限进行此操作。'); |
|
|
|
throw new ErrorMessage('您没有权限进行此操作。'); |
|
|
|
} |
|
|
|
} |
|
|
@ -635,13 +637,11 @@ app.post('/problem/:id/submit', app.multer.fields([{ name: 'answer', maxCount: 1 |
|
|
|
} |
|
|
|
} |
|
|
|
await judge_state.updateRelatedInfo(true); |
|
|
|
await judge_state.updateRelatedInfo(true); |
|
|
|
|
|
|
|
|
|
|
|
let waiting_judge = await WaitingJudge.create({ |
|
|
|
try { |
|
|
|
judge_id: judge_state.id, |
|
|
|
await judger.judge(judge_state, contest_id ? 3 : 2); |
|
|
|
priority: 1, |
|
|
|
} catch (err) { |
|
|
|
type: 'submission' |
|
|
|
throw new ErrorMessage(`无法开始评测:${err.toString()}`); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await waiting_judge.save(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
res.redirect(syzoj.utils.makeUrl(['submission', judge_state.id])); |
|
|
|
res.redirect(syzoj.utils.makeUrl(['submission', judge_state.id])); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|