Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add faster MiqReportResult helper methods for viewing saved report results #17590

Merged
merged 2 commits into from
Jun 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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