From 7d66ad6bf663e45ca6dfc3c8206c9212173e9566 Mon Sep 17 00:00:00 2001 From: Menci Date: Wed, 7 Nov 2018 13:36:23 +0800 Subject: [PATCH] Make index page's ranklist's count configurable --- config-example.json | 1 + modules/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config-example.json b/config-example.json index 5b3d980..2886ec1 100644 --- a/config-example.json +++ b/config-example.json @@ -52,6 +52,7 @@ "problem": 50, "problem_statistics": 10, "judge_state": 10, + "ranklist_index": 20, "ranklist": 20, "discussion": 10, "article_comment": 10, diff --git a/modules/index.js b/modules/index.js index 73741a4..8922302 100644 --- a/modules/index.js +++ b/modules/index.js @@ -31,7 +31,7 @@ const timeAgo = new TimeAgo('zh-CN'); app.get('/', async (req, res) => { try { - let ranklist = await User.query([1, 10], { is_show: true }, [[syzoj.config.sorting.ranklist.field, syzoj.config.sorting.ranklist.order]]); + let ranklist = await User.query([1, syzoj.config.page.ranklist_index || 3], { is_show: true }, [[syzoj.config.sorting.ranklist.field, syzoj.config.sorting.ranklist.order]]); await ranklist.forEachAsync(async x => x.renderInformation()); let notices = (await Article.query(null, { is_notice: true }, [['public_time', 'desc']])).map(article => ({