mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
fix pageCount calculation
This commit is contained in:
@@ -68,7 +68,7 @@ define('forum/topic/posts', [
|
||||
|
||||
var posts = data.posts;
|
||||
|
||||
ajaxify.data.pagination.pageCount = Math.max(1, Math.ceil((posts[0].topic.postcount - 1) / config.postsPerPage));
|
||||
ajaxify.data.pagination.pageCount = Math.max(1, Math.ceil(posts[0].topic.postcount / config.postsPerPage));
|
||||
var direction = config.topicPostSort === 'oldest_to_newest' || config.topicPostSort === 'most_votes' ? 1 : -1;
|
||||
|
||||
var isPostVisible = (ajaxify.data.pagination.currentPage === ajaxify.data.pagination.pageCount && direction === 1) ||
|
||||
|
||||
@@ -387,7 +387,7 @@ topicsController.pagination = function (req, res, callback) {
|
||||
}
|
||||
|
||||
var postCount = parseInt(results.topic.postcount, 10);
|
||||
var pageCount = Math.max(1, Math.ceil((postCount - 1) / results.settings.postsPerPage));
|
||||
var pageCount = Math.max(1, Math.ceil(postCount / results.settings.postsPerPage));
|
||||
|
||||
var paginationData = pagination.create(currentPage, pageCount);
|
||||
paginationData.rel.forEach(function (rel) {
|
||||
|
||||
@@ -52,7 +52,7 @@ Topics.getPageCount = function (tid, uid, callback) {
|
||||
user.getSettings(uid, next);
|
||||
},
|
||||
function (settings, next) {
|
||||
next(null, Math.ceil((parseInt(postCount, 10) - 1) / settings.postsPerPage));
|
||||
next(null, Math.ceil(parseInt(postCount, 10) / settings.postsPerPage));
|
||||
},
|
||||
], callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user