From c24dce4dd671c178adf6411fb2691559ec53c2de Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 19 Apr 2015 15:18:55 -0400 Subject: [PATCH] closes #3062 --- src/categories.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/categories.js b/src/categories.js index 9bcb78f025..d1621921f0 100644 --- a/src/categories.js +++ b/src/categories.js @@ -241,6 +241,7 @@ var async = require('async'), categories[i]['unread-class'] = (parseInt(categories[i].topic_count, 10) === 0 || (hasRead[i] && uid !== 0)) ? '' : 'unread'; categories[i].children = results.children[i]; categories[i].parent = results.parents[i] && !results.parents[i].disabled ? results.parents[i] : null; + calculateTopicPostCount(categories[i]); } } @@ -248,6 +249,17 @@ var async = require('async'), }); }; + function calculateTopicPostCount(category) { + if (!Array.isArray(category.children) || !category.children.length) { + return; + } + + category.children.forEach(function(child) { + }); + category.post_count = postCount; + category.topic_count = topicCount; + } + Categories.getParents = function(cids, callback) { Categories.getMultipleCategoryFields(cids, ['parentCid'], function(err, data) { if (err) {