2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-04-26 18:17:10 +08:00
|
|
|
Report.add_report('flags') do |report|
|
|
|
|
category_filter = report.filters.dig(:category)
|
|
|
|
report.add_filter('category', default: category_filter)
|
|
|
|
|
2019-03-29 17:54:56 +08:00
|
|
|
report.icon = 'flag'
|
|
|
|
report.higher_is_better = false
|
|
|
|
|
|
|
|
basic_report_about(
|
|
|
|
report,
|
|
|
|
ReviewableFlaggedPost,
|
|
|
|
:count_by_date,
|
|
|
|
report.start_date,
|
|
|
|
report.end_date,
|
2019-04-26 18:17:10 +08:00
|
|
|
category_filter
|
2019-03-29 17:54:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
countable = ReviewableFlaggedPost.scores_with_topics
|
2019-04-26 18:17:10 +08:00
|
|
|
|
|
|
|
if category_filter
|
|
|
|
countable.merge!(Topic.in_category_and_subcategories(category_filter))
|
|
|
|
end
|
2019-03-29 17:54:56 +08:00
|
|
|
|
|
|
|
add_counts report, countable, 'reviewable_scores.created_at'
|
|
|
|
end
|