diff --git a/app/models/chargeback_rate_detail.rb b/app/models/chargeback_rate_detail.rb index 00a18020713..6a204b61996 100644 --- a/app/models/chargeback_rate_detail.rb +++ b/app/models/chargeback_rate_detail.rb @@ -24,10 +24,9 @@ class ChargebackRateDetail < ApplicationRecord def charge(relevant_fields, chargeback_fields_present, metric_rollup_records, hours_in_interval) result = {} if (relevant_fields & [metric_keys[0], cost_keys[0]]).present? + metric_value, cost = metric_and_cost_by(metric_rollup_records, hours_in_interval) if !chargeback_fields_present && fixed? cost = 0 - else - metric_value, cost = metric_and_cost_by(metric_rollup_records, hours_in_interval) end metric_keys.each { |field| result[field] = metric_value } cost_keys.each { |field| result[field] = cost }