diff --git a/app/controllers/chargeback_controller.rb b/app/controllers/chargeback_controller.rb index 1e22d52c0a05..77c2e2485c15 100644 --- a/app/controllers/chargeback_controller.rb +++ b/app/controllers/chargeback_controller.rb @@ -345,9 +345,8 @@ def cb_rpts_fetch_saved_report(id) @report_result_id = session[:report_result_id] = rr.id session[:report_result_runtime] = rr.last_run_on if rr.status.downcase == "complete" - @report = rr.report_results session[:rpt_task_id] = nil - if @report.blank? + unless rr.has_report? @saved_reports = cb_rpts_get_all_reps(rr.miq_report_id.to_s) rep = MiqReport.find_by_id(rr.miq_report_id) if x_active_tree == :cb_reports_tree @@ -355,7 +354,7 @@ def cb_rpts_fetch_saved_report(id) end return else - if @report.contains_records? + if rr.contains_records? @html = report_first_page(rr) # Get the first page of the results unless @report.graph.blank? @render_chart = true diff --git a/app/controllers/report_controller/saved_reports.rb b/app/controllers/report_controller/saved_reports.rb index 4e1ab8e02af8..015278bd9c9b 100644 --- a/app/controllers/report_controller/saved_reports.rb +++ b/app/controllers/report_controller/saved_reports.rb @@ -35,10 +35,9 @@ def fetch_saved_report(id) return unless rr.status.downcase == "complete" - @report = rr.report_results session[:rpt_task_id] = nil - if @report.blank? + unless rr.has_report? add_flash(_("Saved Report \"%{time}\" not found, Schedule may have failed") % {:time => format_timezone(rr.created_on, Time.zone, "gtl")}, :error) @@ -56,7 +55,7 @@ def fetch_saved_report(id) return end - unless @report.contains_records? + unless rr.contains_records? add_flash(_("No records found for this report"), :warning) return end