mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 12:43:42 +08:00
e733701887
This commit also adds 'include subcategories' report filter
31 lines
736 B
Ruby
31 lines
736 B
Ruby
# frozen_string_literal: true
|
|
|
|
Report.add_report('flags') do |report|
|
|
category_id, include_subcategories = report.add_category_filter
|
|
|
|
report.icon = 'flag'
|
|
report.higher_is_better = false
|
|
|
|
basic_report_about(
|
|
report,
|
|
ReviewableFlaggedPost,
|
|
:count_by_date,
|
|
report.start_date,
|
|
report.end_date,
|
|
category_id,
|
|
include_subcategories
|
|
)
|
|
|
|
countable = ReviewableFlaggedPost.scores_with_topics
|
|
|
|
if category_id
|
|
if include_subcategories
|
|
countable = countable.where('topics.category_id IN (?)', Category.subcategory_ids(category_id))
|
|
else
|
|
countable = countable.where('topics.category_id = ?', category_id)
|
|
end
|
|
end
|
|
|
|
add_counts report, countable, 'reviewable_scores.created_at'
|
|
end
|