Skip to content

Commit

Permalink
Merge pull request #17590 from NickLaMuro/faster_saved_report_methods
Browse files Browse the repository at this point in the history
Add faster MiqReportResult helper methods for viewing saved report results
(cherry picked from commit dbf6596)

https://bugzilla.redhat.com/show_bug.cgi?id=1594387
  • Loading branch information
jrafanie authored and simaishi committed Jun 22, 2018
1 parent a106253 commit d1177fd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/models/miq_report_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ 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

# Use this over `report_results.contains_records?` if you don't need to
# access the binary_blob associated with the MiqReportResult (chances are you
# don't need it)
def contains_records?
(report && (report.extras || {})[:total_html_rows].to_i.positive?) || html_details.exists?
end

def report_results
if binary_blob
data = binary_blob.data
Expand Down

0 comments on commit d1177fd

Please sign in to comment.