Skip to content

Commit

Permalink
Use current tags for filtering resources in chargeback
Browse files Browse the repository at this point in the history
  • Loading branch information
lpichler committed May 23, 2018
1 parent 7060b2d commit 2c58b28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/models/chargeback/consumption_with_rollups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions app/models/chargeback_vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2c58b28

Please sign in to comment.