Browse Source

Add ORDER BY on problem search

pull/6/head
Menci 7 years ago
parent
commit
aba03bfab9
  1. 2
      modules/problem.js

2
modules/problem.js

@ -104,7 +104,7 @@ app.get('/problems/search', async (req, res) => {
} }
} }
let order = [syzoj.db.literal('`id` = ' + id + ' DESC')]; let order = [syzoj.db.literal('`id` = ' + id + ' DESC'), ['id', 'ASC']];
let paginate = syzoj.utils.paginate(await Problem.count(where), req.query.page, syzoj.config.page.problem); let paginate = syzoj.utils.paginate(await Problem.count(where), req.query.page, syzoj.config.page.problem);
let problems = await Problem.query(paginate, where, order); let problems = await Problem.query(paginate, where, order);

Loading…
Cancel
Save