Browse Source

Fix submissions query

pull/6/head
Menci 8 years ago
parent
commit
7c71cfbf26
  1. 3
      modules/submission.js

3
modules/submission.js

@ -28,7 +28,8 @@ app.get('/submissions', async (req, res) => {
let user = await User.fromName(req.query.submitter || ''); let user = await User.fromName(req.query.submitter || '');
let where = {}; let where = {};
if (user) where.user_id = user.id; if (user) where.user_id = user.id;
if (req.query.problem_id) where.problem_id = parseInt(req.query.problem_id); else if (req.query.submitter) where.user_id = -1;
if (req.query.problem_id) where.problem_id = parseInt(req.query.problem_id) || -1;
where.type = { $ne: 1 }; where.type = { $ne: 1 };
let paginate = syzoj.utils.paginate(await JudgeState.count(where), req.query.page, syzoj.config.page.judge_state); let paginate = syzoj.utils.paginate(await JudgeState.count(where), req.query.page, syzoj.config.page.judge_state);

Loading…
Cancel
Save