2019-04-26 18:17:10 +08:00
|
|
|
Report.add_report('topics_with_no_response') do |report|
|
|
|
|
category_filter = report.filters.dig(:category)
|
|
|
|
report.add_filter('category', default: category_filter)
|
|
|
|
|
2019-03-29 17:54:56 +08:00
|
|
|
report.data = []
|
2019-04-26 18:17:10 +08:00
|
|
|
Topic.with_no_response_per_day(report.start_date, report.end_date, category_filter).each do |r|
|
|
|
|
report.data << { x: r['date'], y: r['count'].to_i }
|
2019-03-29 17:54:56 +08:00
|
|
|
end
|
2019-04-26 18:17:10 +08:00
|
|
|
|
|
|
|
report.total = Topic.with_no_response_total(category_id: category_filter)
|
|
|
|
|
|
|
|
report.prev30Days = Topic.with_no_response_total(start_date: report.start_date - 30.days, end_date: report.start_date, category_id: category_filter)
|
2019-03-29 17:54:56 +08:00
|
|
|
end
|