-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
precision should honor 0 if it is passed in #1479
Comments
Nice catch! We accept PRs if you want or we will fix next sprint. Thanks |
Great.. I seem to have some issues in pushing the changes remotely. You can feel free to include the fix in the next sprint.. BTW, when is the estimate time for the next sprint? |
BTW, here are the two unit tests you can consider adding to cpmBucketManager_spec.js when you fix this issue. it('gets custom bucket strings and it should honor 0', () => { it('gets the custom bucket strings without passing precision and it should honor the default precision', () => { |
Type of issue
Bug
Description
If I give a bucket with precision to 0 and call getPriceBucketString. getPriceBucketString will treat 0 to the default 2 precision.
'buckets': [
{
'precision': 0,
'min': 3,
'max': 18,
'increment': 0.05,
}
Steps to reproduce
Expected results
cpm.custom should be 17 as I set precision to 0
Actual results
cpm.custom is emit as 16.51.
Other information
Root cause seems to be around in cpmBucketManager
function getCpmTarget(cpm, increment, precision) {
if (!precision) {
precision = _defaultPrecision;
}
!precision will evaluate 0 as true and defaultPrecision is used.
Shall we consider
(!precision && precision != 0)
The text was updated successfully, but these errors were encountered: