Browse Source

If score query is 0 to 100, cancel them.

master
t123yh 7 years ago
parent
commit
74e0ff42c5
  1. 14
      modules/contest.js
  2. 14
      modules/submission.js

14
modules/contest.js

@ -324,12 +324,14 @@ app.get('/contest/:id/submissions', async (req, res) => {
if (!isNaN(minScore) || !isNaN(maxScore)) { if (!isNaN(minScore) || !isNaN(maxScore)) {
if (isNaN(minScore)) minScore = 0; if (isNaN(minScore)) minScore = 0;
if (isNaN(maxScore)) maxScore = 100; if (isNaN(maxScore)) maxScore = 100;
where.score = { if (!(minScore === 0 && maxScore === 100)) {
$and: { where.score = {
$gte: parseInt(minScore), $and: {
$lte: parseInt(maxScore) $gte: parseInt(minScore),
} $lte: parseInt(maxScore)
}; }
};
}
} }
} }

14
modules/submission.js

@ -69,12 +69,14 @@ app.get('/submissions', async (req, res) => {
if (!isNaN(minScore) || !isNaN(maxScore)) { if (!isNaN(minScore) || !isNaN(maxScore)) {
if (isNaN(minScore)) minScore = 0; if (isNaN(minScore)) minScore = 0;
if (isNaN(maxScore)) maxScore = 100; if (isNaN(maxScore)) maxScore = 100;
where.score = { if (!(minScore === 0 && maxScore === 100)) {
$and: { where.score = {
$gte: parseInt(minScore), $and: {
$lte: parseInt(maxScore) $gte: parseInt(minScore),
} $lte: parseInt(maxScore)
}; }
};
}
} }
if (req.query.language) { if (req.query.language) {

Loading…
Cancel
Save