From aba03bfab999878719a5cc4c70e49f6808575597 Mon Sep 17 00:00:00 2001 From: Menci Date: Mon, 24 Jul 2017 11:14:02 +0800 Subject: [PATCH] Add ORDER BY on problem search --- modules/problem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/problem.js b/modules/problem.js index b72cdb2..2340780 100644 --- a/modules/problem.js +++ b/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 problems = await Problem.query(paginate, where, order);