From 6603a2c1e2515151c8d2ce0cb0bce317fd6cf3e4 Mon Sep 17 00:00:00 2001 From: Menci Date: Mon, 10 Dec 2018 19:30:51 +0800 Subject: [PATCH] Improve submissions filtering --- modules/admin.js | 3 ++- modules/submission.js | 3 ++- views/admin_rejudge.ejs | 11 ++++++----- views/submissions.ejs | 1 + 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/admin.js b/modules/admin.js index 0f0b49f..0505b7b 100644 --- a/modules/admin.js +++ b/modules/admin.js @@ -354,7 +354,8 @@ app.post('/admin/rejudge', async (req, res) => { }; if (req.body.language) { - if (req.body.language === 'submit-answer') where.language = ''; + if (req.body.language === 'submit-answer') where.language = { $or: [{ $eq: '', }, { $eq: null }] }; + else if (req.body.language === 'non-submit-answer') where.language = { $not: '' }; else where.language = req.body.language; } if (req.body.status) where.status = { $like: req.body.status + '%' }; diff --git a/modules/submission.js b/modules/submission.js index 3a64702..1a1fe5b 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -63,7 +63,8 @@ app.get('/submissions', async (req, res) => { } if (req.query.language) { - if (req.query.language === 'submit-answer') where.language = ''; + if (req.query.language === 'submit-answer') where.language = { $or: [{ $eq: '', }, { $eq: null }] }; + else if (req.query.language === 'non-submit-answer') where.language = { $not: '' }; else where.language = req.query.language; } if (req.query.status) where.status = { $like: req.query.status + '%' }; diff --git a/views/admin_rejudge.ejs b/views/admin_rejudge.ejs index 4e68204..ed5b8d2 100644 --- a/views/admin_rejudge.ejs +++ b/views/admin_rejudge.ejs @@ -17,10 +17,11 @@
@@ -32,10 +33,10 @@
diff --git a/views/submissions.ejs b/views/submissions.ejs index 9d37ffe..c015c0a 100644 --- a/views/submissions.ejs +++ b/views/submissions.ejs @@ -38,6 +38,7 @@