From abdfa630b4f205cdd4ef10f6bdcfe56b8ea9e6b9 Mon Sep 17 00:00:00 2001 From: t123yh Date: Mon, 28 Aug 2017 19:27:31 +0800 Subject: [PATCH] Fix error. --- modules/problem.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/problem.js b/modules/problem.js index 6f54156..74312da 100644 --- a/modules/problem.js +++ b/modules/problem.js @@ -128,10 +128,9 @@ app.get('/problems/search', async (req, res) => { if (sort === 'ac_rate') { sortVal = { raw: 'ac_num / submit_num' }; } - let order = [syzoj.db.literal('`id` = ' + id + ' DESC'), [sortVal, order]]; 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, [syzoj.db.literal('`id` = ' + id + ' DESC'), [sortVal, order]]); await problems.forEachAsync(async problem => { problem.allowedEdit = await problem.isAllowedEditBy(res.locals.user);