Skip to content

Commit

Permalink
Select resources when there are nil in MetricRollups records
Browse files Browse the repository at this point in the history
In this PR ManageIQ#11648 we
introduced selecting rates according to first MetricRollup
record of group. We can do it because group of these records
belong to one resource.

Selection is based on
MetricRollup#parent_host or parent_ems_cluster or
parent_storage or parent_ems but sometimes this fields in
MetricRollup are nil and it produces empty cells on the
report - it is because proper rate was not selected.

Fix provides that we are selecting parents from
the resource direcly when there are not exists in
MetricRollup.
  • Loading branch information
lpichler committed Oct 27, 2016
1 parent c4f7de4 commit 243905e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/models/metric/chargeback_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def tag_list_reconstruct
end

def resource_parents
[parent_host, parent_ems_cluster, parent_storage, parent_ems, resource.try(:tenant)].compact
[parent_host || resource.try(:host),
parent_ems_cluster || resource.try(:ems_cluster),
parent_storage || resource.try(:storage),
parent_ems || resource.try(:ext_management_system),
resource.try(:tenant)
].compact
end
end

0 comments on commit 243905e

Please sign in to comment.