Skip to content
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

ChargebackRateDetail should take care of charging #12616

Merged

Conversation

isimluk
Copy link
Member

@isimluk isimluk commented Nov 14, 2016

This moves the charging responsibility from chargeback downto chargeback_rate_detail.

This series of refactorings are the ground works for dynamic charging (needed to charge differently per different storage types). Once we have this, the rate_detail can charge per dynamic field i.e. storate_allocated_ssd_cost, storage_allocated_hiperf_cost (that is related to #12501).

@miq-bot add_label chargeback, refactoring
@miq-bot assign @gtanzillo

@miq-bot
Copy link
Member

miq-bot commented Nov 14, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

@isimluk isimluk force-pushed the only-rate-should-know-what-to-charge branch 2 times, most recently from 36967a7 to 8cde768 Compare November 15, 2016 08:15
Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the minor naming comment, it looks good to me 👍

@@ -210,6 +210,17 @@ def contiguous_tiers?
!error
end

def affects_metrics
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the naming of these methods. How about metrics_keys and cost_keys?

This will be needed once we will have ChargebackRateDetails with dynamic
rate/metric names.
Not all the rates are relevant to the given chargeback. At this moment,
the field is calculated only if the given chargeback type is able to
carry on the result. In future, we may be able to calculate only those
fields/columns needed by user. Then this method will come in handy.

Using word fields vs. columns as it is common more common in the
chargeback's codebase now.
@isimluk isimluk force-pushed the only-rate-should-know-what-to-charge branch from 8cde768 to 4588c62 Compare November 18, 2016 15:48
@isimluk
Copy link
Member Author

isimluk commented Nov 18, 2016

Amended the method name as advised.

@miq-bot
Copy link
Member

miq-bot commented Nov 18, 2016

Checked commits isimluk/manageiq@16d00c3~...4588c62 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
3 files checked, 1 offense detected

app/models/chargeback.rb

@gtanzillo gtanzillo added this to the Sprint 50 Ending Dec 5, 2016 milestone Nov 18, 2016
@gtanzillo gtanzillo merged commit f0322a3 into ManageIQ:master Nov 18, 2016
@simaishi
Copy link
Contributor

Backported to Euwe via #13419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants