Skip to content

Commit

Permalink
allow to access saved report after associated task deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
yrudman committed May 18, 2017
1 parent 197079a commit 29fec63
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/controllers/report_controller/saved_reports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def fetch_saved_report(id)
if admin_user? || current_user.miq_group_ids.include?(rr.miq_group_id)
@report_result_id = session[:report_result_id] = rr.id
session[:report_result_runtime] = rr.last_run_on
task = MiqTask.find_by_id(rr.miq_task_id)
if rr.status.downcase == "complete"
if report_finished?(rr)
@report = rr.report_results
session[:rpt_task_id] = nil
if @report.blank?
Expand Down Expand Up @@ -139,6 +138,14 @@ def get_all_saved_reports

private

def report_finished?(report_result)
if MiqTask.exists?(report_result.miq_task_id)
report_result.status.downcase == "complete"
else
!report_result.last_run_on.blank?
end
end

# Build the main Saved Reports tree
def build_savedreports_tree
TreeBuilderReportSavedReports.new('savedreports_tree', 'savedreports', @sb)
Expand Down

0 comments on commit 29fec63

Please sign in to comment.