From 74e0ff42c549b2c01ff48d3db493351da6aafd20 Mon Sep 17 00:00:00 2001 From: t123yh Date: Fri, 25 Aug 2017 22:00:43 +0800 Subject: [PATCH] If score query is 0 to 100, cancel them. --- modules/contest.js | 14 ++++++++------ modules/submission.js | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/contest.js b/modules/contest.js index 91536bc..f1b4a54 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -324,12 +324,14 @@ app.get('/contest/:id/submissions', async (req, res) => { if (!isNaN(minScore) || !isNaN(maxScore)) { if (isNaN(minScore)) minScore = 0; if (isNaN(maxScore)) maxScore = 100; - where.score = { - $and: { - $gte: parseInt(minScore), - $lte: parseInt(maxScore) - } - }; + if (!(minScore === 0 && maxScore === 100)) { + where.score = { + $and: { + $gte: parseInt(minScore), + $lte: parseInt(maxScore) + } + }; + } } } diff --git a/modules/submission.js b/modules/submission.js index 08a8bf2..340908e 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -69,12 +69,14 @@ app.get('/submissions', async (req, res) => { if (!isNaN(minScore) || !isNaN(maxScore)) { if (isNaN(minScore)) minScore = 0; if (isNaN(maxScore)) maxScore = 100; - where.score = { - $and: { - $gte: parseInt(minScore), - $lte: parseInt(maxScore) - } - }; + if (!(minScore === 0 && maxScore === 100)) { + where.score = { + $and: { + $gte: parseInt(minScore), + $lte: parseInt(maxScore) + } + }; + } } if (req.query.language) {