FIX: Include subcategories in 'posts' report (#9410)

FIX: Include subcategories in ‘posts’ report (#9410)

diff --git a/app/models/post.rb b/app/models/post.rb
index b57a950..1fe1bed 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -767,7 +767,7 @@ class Post < ActiveRecord::Base
   def self.public_posts_count_per_day(start_date, end_date, category_id = nil)
     result = public_posts.where('posts.created_at >= ? AND posts.created_at <= ?', start_date, end_date)
       .where(post_type: Post.types[:regular])
-    result = result.where('topics.category_id = ?', category_id) if category_id
+    result = result.where('topics.category_id IN (?)', Category.subcategory_ids(category_id.to_i)) if category_id
     result
       .group('date(posts.created_at)')
       .order('date(posts.created_at)')

GitHub sha: 799ddeea

This commit appears in #9410 which was merged by udan11.