Browse Source

If score query is 0 to 100, cancel them.

pull/6/head
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)) 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)
}
};
}
}
}

14
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) {

Loading…
Cancel
Save