-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing guard conditions in Chargeback #17463
Removing guard conditions in Chargeback #17463
Conversation
9a6faf4
to
0a5c61a
Compare
Goal: remove this condition
Goal: Make this condition as is in affects_report_fields and then remove the condition
Calculation with zero rates is usefull and it is not affecting anything.
this filtering is already done in rate_details_relevant_to in ChargebackRateDetail
0a5c61a
to
f5bc378
Compare
app/models/chargeback_rate_detail.rb
Outdated
@@ -94,7 +94,7 @@ def rate_values(consumption, options) | |||
|
|||
def charge(relevant_fields, consumption, options) | |||
result = {} | |||
if (relevant_fields & [metric_key]).present? || (relevant_fields & cost_keys).present? | |||
if (relevant_fields & [metric_key]).present? || ((cost_keys.to_set & report_cols).present? && !gratis?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is from ChargebackRateDetail#affects_report_fields
this filtering is covered by ChargebackRate#rate_details_relevant_to
Checked commits lpichler/manageiq@433c2cc~...7478035 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Walking through the commits one by one I was able to follow the process. Looking at the net of those changes, though, it's surprising that it's only those few lines. 👍
@jrafanie what do you think?
We have same(on first look apparently) condition on two places.
This is commit based story how to remove condition from one place in
ChargebackRateDetail#charge
method.Thanks to it method
ChargebackRateDetail#charge
is more clean.follow up after:
#17387
#17414
cc @gtanzillo
@miq-bot assign @jrafanie