Skip to content

Commit

Permalink
Merge pull request #17747 from lpichler/fix_translation_from_v_derive…
Browse files Browse the repository at this point in the history
…d_cpu_total_cores_used_to_cpu_usage_rate_average_chargeback_for_projects

Move VIRTUAL_COL_USES translation to col_index method in ChargeableField
(cherry picked from commit ee216b0)

https://bugzilla.redhat.com/show_bug.cgi?id=1613295
  • Loading branch information
gtanzillo authored and simaishi committed Aug 17, 2018
1 parent c00eb23 commit ced41ae
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/models/chargeable_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def self.cols_on_metric_rollup

def self.col_index(column)
@rate_cols ||= {}
column = VIRTUAL_COL_USES[column] || column
@rate_cols[column] ||= cols_on_metric_rollup.index(column.to_s)
end

Expand Down
1 change: 0 additions & 1 deletion app/models/chargeback/consumption_with_rollups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def tag_list_with_prefix
end

def sum(metric, sub_metric = nil)
metric = ChargeableField::VIRTUAL_COL_USES[metric] || metric
values(metric, sub_metric).sum
end

Expand Down
2 changes: 1 addition & 1 deletion spec/factories/chargeable_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

factory :chargeable_field_cpu_cores_used, :parent => :chargeable_field do
description 'Used CPU in Cores'
metric 'cpu_usage_rate_average'
metric 'v_derived_cpu_total_cores_used'
group 'cpu_cores'
source 'used'
end
Expand Down

0 comments on commit ced41ae

Please sign in to comment.