|
|
@ -175,19 +175,15 @@ function calculateTopicPostCount(category) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var postCount = category.post_count;
|
|
|
|
let postCount = category.post_count;
|
|
|
|
var topicCount = category.topic_count;
|
|
|
|
let topicCount = category.topic_count;
|
|
|
|
if (!Array.isArray(category.children) || !category.children.length) {
|
|
|
|
if (Array.isArray(category.children)) {
|
|
|
|
category.totalPostCount = postCount;
|
|
|
|
|
|
|
|
category.totalTopicCount = topicCount;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
category.children.forEach(function (child) {
|
|
|
|
category.children.forEach(function (child) {
|
|
|
|
calculateTopicPostCount(child);
|
|
|
|
calculateTopicPostCount(child);
|
|
|
|
postCount += parseInt(child.totalPostCount, 10) || 0;
|
|
|
|
postCount += parseInt(child.totalPostCount, 10) || 0;
|
|
|
|
topicCount += parseInt(child.totalTopicCount, 10) || 0;
|
|
|
|
topicCount += parseInt(child.totalTopicCount, 10) || 0;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
category.totalPostCount = postCount;
|
|
|
|
category.totalPostCount = postCount;
|
|
|
|
category.totalTopicCount = topicCount;
|
|
|
|
category.totalTopicCount = topicCount;
|
|
|
|