Browse Source

Fix 共 xx 条回复 wrong

pull/6/head
Menci 7 years ago
parent
commit
1b62cc51e2
  1. 7
      modules/discussion.js
  2. 2
      views/article.ejs

7
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);

2
views/article.ejs

@ -49,7 +49,7 @@
</div>
<% if (comments.length) { %>
<div class="ui comments" style="max-width: none;">
<h3 class="ui dividing header">共 <%= comments.length %> 条回复</h3>
<h3 class="ui dividing header">共 <%= commentsCount %> 条回复</h3>
<% for (let comment of comments) { %>
<div class="comment">
<a class="avatar">

Loading…
Cancel
Save