|
|
|
@ -87,9 +87,12 @@ app.get('/submissions', async (req, res) => {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
app.get('/submissions/:id/ajax', async (req, res) => { |
|
|
|
|
app.get('/submissions/:ids/ajax', async (req, res) => { |
|
|
|
|
try { |
|
|
|
|
let judge_state = await JudgeState.fromID(req.params.id); |
|
|
|
|
let ids = req.params.ids.split(','), rendered = {}; |
|
|
|
|
|
|
|
|
|
for (let id of ids) { |
|
|
|
|
let judge_state = await JudgeState.fromID(id); |
|
|
|
|
if (!judge_state) throw new ErrorMessage('无此提交记录。'); |
|
|
|
|
|
|
|
|
|
await judge_state.loadRelationships(); |
|
|
|
@ -113,10 +116,17 @@ app.get('/submissions/:id/ajax', async (req, res) => {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
res.render('submissions_item', { |
|
|
|
|
let o = { pending: judge_state.pending, html: null, status: judge_state.status }; |
|
|
|
|
|
|
|
|
|
o.html = await require('util').promisify(app.render).bind(app)('submissions_item', { |
|
|
|
|
contest: contest, |
|
|
|
|
judge: judge_state |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
rendered[id] = o; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
res.send(rendered); |
|
|
|
|
} catch (e) { |
|
|
|
|
syzoj.log(e); |
|
|
|
|
res.render('error', { |
|
|
|
|