From c541d66b337c11b5bf378575079d38bf5854559b Mon Sep 17 00:00:00 2001 From: Ari Zellner Date: Wed, 19 Apr 2017 20:09:43 +0300 Subject: [PATCH] group chargeback with unknown image under 'unknown image' --- app/models/chargeback_container_image.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/chargeback_container_image.rb b/app/models/chargeback_container_image.rb index 003cbb10043..1178b02b500 100644 --- a/app/models/chargeback_container_image.rb +++ b/app/models/chargeback_container_image.rb @@ -45,6 +45,7 @@ def self.build_results_for_report_ChargebackContainerImage(options) end @unknown_project ||= OpenStruct.new(:id => 0, :name => _('Unknown Project'), :ems_ref => _('Unknown')) + @unknown_image ||= OpenStruct.new(:id => 0, :full_name => _('Unknown Image')) build_results_for_report_chargeback(options) end @@ -55,7 +56,7 @@ def self.default_key(metric_rollup_record, ts_key) end def self.image(consumption) - @data_index.fetch_path(:container_image, :by_container_id, consumption.resource_id) + @data_index.fetch_path(:container_image, :by_container_id, consumption.resource_id) || @unknown_image end def self.project(consumption) @@ -90,8 +91,7 @@ def self.report_col_options def init_extra_fields(consumption) self.project_name = self.class.project(consumption).name - # until image archiving is implemented - self.image_name = self.class.image(consumption).try(:full_name) || _('Deleted') + self.image_name = self.class.image(consumption).try(:full_name) self.project_uid = self.class.project(consumption).ems_ref self.provider_name = consumption.parent_ems.try(:name) self.provider_uid = consumption.parent_ems.try(:guid)