-
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
Chargeback: Fix rate adjustment rounding bug #13331
Chargeback: Fix rate adjustment rounding bug #13331
Commits on Jan 20, 2017
-
This is teached in 7th or 8th grade, so backend developers shall comprehend.
Configuration menu - View commit details
-
Copy full SHA for 839660c - Browse repository at this point
Copy the full SHA 839660cView commit details -
The adjustment measure is not dependent on the value
The adjustment is function of two units. It is not function of a value. It is independent. It does not depend on each other. The value does not affect the adjustment measure.
Configuration menu - View commit details
-
Copy full SHA for 70dada9 - Browse repository at this point
Copy the full SHA 70dada9View commit details -
Extract common value out of parenthesis
Like they do in algebra classes.
Configuration menu - View commit details
-
Copy full SHA for 597f528 - Browse repository at this point
Copy the full SHA 597f528View commit details -
Configuration menu - View commit details
-
Copy full SHA for f4b514a - Browse repository at this point
Copy the full SHA f4b514aView commit details -
Refactor: replace switch statement with hash
Hash can be re-used as it refers to what MetricRollup table contains.
Configuration menu - View commit details
-
Copy full SHA for cf64ee9 - Browse repository at this point
Copy the full SHA cf64ee9View commit details -
Rate adjustment should not depend on metric_value
Then we can memoize it and save some time calculating it again and again.
Configuration menu - View commit details
-
Copy full SHA for 10b3e76 - Browse repository at this point
Copy the full SHA 10b3e76View commit details -
Configuration menu - View commit details
-
Copy full SHA for 217d831 - Browse repository at this point
Copy the full SHA 217d831View commit details -
Use BigDecimal for rate_adjustment calculation
Float has insufficient precision. Already 1024**-3 causes problems.
Configuration menu - View commit details
-
Copy full SHA for fff5d89 - Browse repository at this point
Copy the full SHA fff5d89View commit details -
Configuration menu - View commit details
-
Copy full SHA for 76b418a - Browse repository at this point
Copy the full SHA 76b418aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 943a62e - Browse repository at this point
Copy the full SHA 943a62eView commit details -
Workaround buggy version of ruby
Certain version of ruby (before 2.3.3) have problems with BigDecimal.new(1) <= Float::INFINITY or Float::INFINITY >= BigDecimal.new(1) Forcing BigDecimal to float in this case will not hurt.
Configuration menu - View commit details
-
Copy full SHA for bb40e8a - Browse repository at this point
Copy the full SHA bb40e8aView commit details