FIX: Include subcategories in report (#86)

This commit is contained in:
Dan Ungureanu 2020-04-10 12:50:44 +03:00 committed by GitHub
parent 329d8aff30
commit dafb1d7c7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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