Browse Source

If score query is 0 to 100, cancel them.

pull/6/head
t123yh 7 years ago
parent
commit
74e0ff42c5
  1. 2
      modules/contest.js
  2. 2
      modules/submission.js

2
modules/contest.js

@ -324,6 +324,7 @@ 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;
if (!(minScore === 0 && maxScore === 100)) {
where.score = { where.score = {
$and: { $and: {
$gte: parseInt(minScore), $gte: parseInt(minScore),
@ -332,6 +333,7 @@ app.get('/contest/:id/submissions', async (req, res) => {
}; };
} }
} }
}
if (req.query.language) { if (req.query.language) {
if (req.query.language === 'submit-answer') where.language = ''; if (req.query.language === 'submit-answer') where.language = '';

2
modules/submission.js

@ -69,6 +69,7 @@ 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;
if (!(minScore === 0 && maxScore === 100)) {
where.score = { where.score = {
$and: { $and: {
$gte: parseInt(minScore), $gte: parseInt(minScore),
@ -76,6 +77,7 @@ app.get('/submissions', async (req, res) => {
} }
}; };
} }
}
if (req.query.language) { if (req.query.language) {
if (req.query.language === 'submit-answer') where.language = ''; if (req.query.language === 'submit-answer') where.language = '';

Loading…
Cancel
Save