From 2c58b287e789414abd16d9dc58e3fa368e4fc80a Mon Sep 17 00:00:00 2001 From: lpichler Date: Wed, 23 May 2018 19:31:15 +0200 Subject: [PATCH] Use current tags for filtering resources in chargeback --- app/models/chargeback/consumption_with_rollups.rb | 2 +- app/models/chargeback_vm.rb | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/models/chargeback/consumption_with_rollups.rb b/app/models/chargeback/consumption_with_rollups.rb index 5a96dd358092..73ac378784f1 100644 --- a/app/models/chargeback/consumption_with_rollups.rb +++ b/app/models/chargeback/consumption_with_rollups.rb @@ -22,7 +22,7 @@ def hash_features_affecting_rate def tag_names @tag_names ||= @rollups.inject([]) do |memo, rollup| - memo |= rollup.tag_names.split('|') if rollup.tag_names.present? + memo |= rollup.resource.tags.collect(&:name) if rollup.resource.tags.collect(&:name).present? memo end end diff --git a/app/models/chargeback_vm.rb b/app/models/chargeback_vm.rb index 149a6d0fa687..f0f440e5424e 100644 --- a/app/models/chargeback_vm.rb +++ b/app/models/chargeback_vm.rb @@ -82,11 +82,7 @@ def self.build_results_for_report_ChargebackVm(options) def self.where_clause(records, options, region) scope = records.where(:resource_type => "VmOrTemplate") - if options[:tag] && (@report_user.nil? || !@report_user.self_service?) - scope.for_tag_names(options[:tag].split("/")[2..-1]) - else - scope.where(:resource => vms(region)) - end + scope.where(:resource => vms(region)) end def self.extra_resources_without_rollups(region)