diff --git a/modules/submission.js b/modules/submission.js index 14dfb20..a2473d0 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -30,6 +30,22 @@ app.get('/submissions', async (req, res) => { if (user) where.user_id = user.id; else if (req.query.submitter) where.user_id = -1; if (req.query.problem_id) where.problem_id = parseInt(req.query.problem_id) || -1; + + let minScore = parseInt(req.query.min_score); + if (isNaN(minScore)) minScore = 0; + let maxScore = parseInt(req.query.max_score); + if (isNaN(maxScore)) maxScore = 0; + + where.score = { + $and: { + $gte: parseInt(minScore), + $lte: parseInt(maxScore) + } + }; + + if (req.query.language) where.language = req.query.language; + if (req.query.status) where.status = req.query.status; + where.type = { $ne: 1 }; let paginate = syzoj.utils.paginate(await JudgeState.count(where), req.query.page, syzoj.config.page.judge_state); @@ -42,10 +58,7 @@ app.get('/submissions', async (req, res) => { res.render('submissions', { judge_state: judge_state, paginate: paginate, - form: { - submitter: req.query.submitter || '', - problem_id: req.query.problem_id || '' - } + form: req.query }); } catch (e) { syzoj.log(e); diff --git a/views/problems.ejs b/views/problems.ejs index 773df3a..e86f80a 100644 --- a/views/problems.ejs +++ b/views/problems.ejs @@ -6,7 +6,7 @@ if (typeof tags !== 'undefined') tagIDs = tags.map(x => x.id); %>