Skip to content

Commit

Permalink
Fix:Include also sub_metric key in chargeback rate
Browse files Browse the repository at this point in the history
Follow UP: ManageIQ#17414
  • Loading branch information
lpichler committed Sep 25, 2018
1 parent 7467510 commit cb54c7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/chargeable_field.rb
Expand Up @@ -73,8 +73,8 @@ def metric_key(sub_metric = nil)
# Fixed metric has _1 or _2 in name but column
# fixed_compute_metric is used in report and calculations
# TODO: remove and unify with metric_key
def metric_column_key
fixed? ? metric_key.gsub(/\_1|\_2/, '') : metric_key
def metric_column_key(sub_metric)
fixed? ? metric_key(sub_metric).gsub(/\_1|\_2/, '') : metric_key
end

def cost_keys(sub_metric = nil)
Expand Down
2 changes: 1 addition & 1 deletion app/models/chargeback_rate.rb
Expand Up @@ -39,7 +39,7 @@ def rate_details_relevant_to(report_cols, allowed_cols)
# we can memoize, as we get the same report_cols through the life of the object
@relevant ||= begin
chargeback_rate_details.select do |r|
r.affects_report_fields(report_cols) && allowed_cols.include?(r.metric_column_key)
r.affects_report_fields(report_cols) && allowed_cols.include?(r.metric_column_key(r.sub_metric))
end
end
end
Expand Down

0 comments on commit cb54c7d

Please sign in to comment.