From dafb1d7c7fcc50ffe37285996a04c42509ccd768 Mon Sep 17 00:00:00 2001 From: Dan Ungureanu Date: Fri, 10 Apr 2020 12:50:44 +0300 Subject: [PATCH] FIX: Include subcategories in report (#86) --- plugin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.rb b/plugin.rb index 3efd9af..452195f 100644 --- a/plugin.rb +++ b/plugin.rb @@ -317,11 +317,11 @@ SQL category_filter = report.filters.dig(:category) report.add_filter('category', default: category_filter) if category_filter - accepted_solutions = accepted_solutions.joins(:topic).where("topics.category_id = ?", category_filter) + accepted_solutions = accepted_solutions.joins(:topic).where("topics.category_id IN (?)", Category.subcategory_ids(category_filter.to_i)) end else if report.category_id - accepted_solutions = accepted_solutions.joins(:topic).where("topics.category_id = ?", report.category_id) + accepted_solutions = accepted_solutions.joins(:topic).where("topics.category_id IN (?)", Category.subcategory_ids(report.category_id.to_i)) end end