2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-04-26 06:17:10 -04:00
|
|
|
Report.add_report('topics') do |report|
|
2020-04-22 04:52:50 -04:00
|
|
|
category_id, include_subcategories = report.add_category_filter
|
2019-04-26 06:17:10 -04:00
|
|
|
|
2020-04-22 04:52:50 -04:00
|
|
|
basic_report_about report, Topic, :listable_count_per_day, report.start_date, report.end_date, category_id, include_subcategories
|
2019-04-26 06:17:10 -04:00
|
|
|
|
2019-03-29 05:54:56 -04:00
|
|
|
countable = Topic.listable_topics
|
2020-04-22 04:52:50 -04:00
|
|
|
countable = countable.where(category_id: include_subcategories ? Category.subcategory_ids(category_id) : category_id) if category_id
|
|
|
|
|
2019-03-29 05:54:56 -04:00
|
|
|
add_counts report, countable, 'topics.created_at'
|
|
|
|
end
|