mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
default to zero if post_count topic_count is falsy
This commit is contained in:
@@ -253,8 +253,12 @@ var async = require('async'),
|
||||
if (!Array.isArray(category.children) || !category.children.length) {
|
||||
return;
|
||||
}
|
||||
var postCount = parseInt(category.post_count, 10) || 0;
|
||||
var topicCount = parseInt(category.topic_count, 10) || 0;
|
||||
|
||||
category.children.forEach(function(child) {
|
||||
postCount += parseInt(child.post_count, 10) || 0;
|
||||
topicCount += parseInt(child.topic_count, 10) || 0;
|
||||
});
|
||||
category.post_count = postCount;
|
||||
category.topic_count = topicCount;
|
||||
|
||||
Reference in New Issue
Block a user