Skip to content

Commit

Permalink
Add MiqReportResult#valid_report_column?
Browse files Browse the repository at this point in the history
https://bugzilla.redhat.com/show_bug.cgi?id=1590908

A quicker check than having to use `MiqReportResult#report_results`,
since binary_blob doesn't need to be loaded into memory.  On top of
that, generally the binary_blob.data isn't even used in the controller
at the end of the day, and this version of the MiqReport record ends up
being what is used when generating the page for viewing.
  • Loading branch information
NickLaMuro committed Jun 18, 2018
1 parent 64a240b commit 6b2e57d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/miq_report_result.rb
Expand Up @@ -53,6 +53,13 @@ def status_message
miq_task.nil? ? _("The task associated with this report is no longer available") : miq_task.message
end

# Use this method over `report_results` if you don't plan on using the
# `binary_blob` associated with the MiqReportResult (chances are you don't
# need it).
def valid_report_column?
report.kind_of?(MiqReport)
end

def report_results
if binary_blob
data = binary_blob.data
Expand Down

0 comments on commit 6b2e57d

Please sign in to comment.