FIX: use 'topic_all_time' as topic count failover in /categories page
This commit is contained in:
parent
70a1d8bce8
commit
5833e96017
|
@ -48,8 +48,8 @@ CategoryList.reopenClass({
|
|||
break;
|
||||
}
|
||||
default:
|
||||
c.stat = `<span class="value">${c.topic_count}</span>`;
|
||||
c.statTitle = I18n.t("categories.topic_sentence", { count: c.topic_count });
|
||||
c.stat = `<span class="value">${c.topics_all_time}</span>`;
|
||||
c.statTitle = I18n.t("categories.topic_sentence", { count: c.topics_all_time });
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ class CategoryDetailedSerializer < BasicCategorySerializer
|
|||
:topics_week,
|
||||
:topics_month,
|
||||
:topics_year,
|
||||
:topics_all_time,
|
||||
:description_excerpt,
|
||||
:is_uncategorized,
|
||||
:subcategory_ids
|
||||
|
@ -48,6 +49,10 @@ class CategoryDetailedSerializer < BasicCategorySerializer
|
|||
count_with_subcategories(:topics_year)
|
||||
end
|
||||
|
||||
def topics_all_time
|
||||
count_with_subcategories(:topic_count)
|
||||
end
|
||||
|
||||
def count_with_subcategories(method)
|
||||
count = object.send(method) || 0
|
||||
object.subcategories.each do |category|
|
||||
|
|
Loading…
Reference in New Issue