0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/app/models/concerns/reports/topics.rb
2023-01-09 14:14:59 +00:00

27 lines
777 B
Ruby
Vendored

# frozen_string_literal: true
module Reports::Topics
extend ActiveSupport::Concern
class_methods do
def report_topics(report)
category_id, include_subcategories = report.add_category_filter
basic_report_about report,
Topic,
:listable_count_per_day,
report.start_date,
report.end_date,
category_id,
include_subcategories
countable = Topic.listable_topics
countable =
countable.where(
category_id: include_subcategories ? Category.subcategory_ids(category_id) : category_id,
) if category_id
add_counts report, countable, "topics.created_at"
end
end
end