From 1b62cc51e28594544b894c3ad3d67e20fa7b65e6 Mon Sep 17 00:00:00 2001 From: Menci Date: Sun, 9 Jul 2017 21:30:34 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20=E5=85=B1=20xx=20=E6=9D=A1=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=20wrong?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/discussion.js | 7 ++++--- views/article.ejs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/discussion.js b/modules/discussion.js index cfcd419..b61f430 100644 --- a/modules/discussion.js +++ b/modules/discussion.js @@ -85,8 +85,8 @@ app.get('/article/:id', async (req, res) => { article.content = await syzoj.utils.markdown(article.content); let where = { article_id: id }; - - let paginate = syzoj.utils.paginate(await ArticleComment.count(where), req.query.page, syzoj.config.page.article_comment); + let commentsCount = await ArticleComment.count(where); + let paginate = syzoj.utils.paginate(commentsCount, req.query.page, syzoj.config.page.article_comment); let comments = await ArticleComment.query(paginate, where, [['public_time', 'desc']]); @@ -108,7 +108,8 @@ app.get('/article/:id', async (req, res) => { article: article, comments: comments, paginate: paginate, - problem: problem + problem: problem, + commentsCount: commentsCount }); } catch (e) { syzoj.log(e); diff --git a/views/article.ejs b/views/article.ejs index c363d59..0dc878f 100644 --- a/views/article.ejs +++ b/views/article.ejs @@ -49,7 +49,7 @@ <% if (comments.length) { %>
-

共 <%= comments.length %> 条回复

+

共 <%= commentsCount %> 条回复

<% for (let comment of comments) { %>