diff --git a/app/controllers/admin/reports_controller.rb b/app/controllers/admin/reports_controller.rb index f24ee3f5287..8a47b8a9d12 100644 --- a/app/controllers/admin/reports_controller.rb +++ b/app/controllers/admin/reports_controller.rb @@ -7,12 +7,9 @@ class Admin::ReportsController < Admin::AdminController raise Discourse::NotFound unless report_type =~ /^[a-z0-9\_]+$/ - start_date = 1.month.ago - start_date = Time.parse(params[:start_date]) if params[:start_date].present? - - end_date = start_date + 1.month - end_date = Time.parse(params[:end_date]) if params[:end_date].present? - + start_date = params[:start_date].present? ? Time.parse(params[:start_date]) : 30.days.ago + end_date = params[:end_date].present? ? Time.parse(params[:end_date]) : start_date + 30.days + if params.has_key?(:category_id) && params[:category_id].to_i > 0 category_id = params[:category_id].to_i else