Skip to content

Commit

Permalink
add () for correct order of operations in scaling increments for curr…
Browse files Browse the repository at this point in the history
…ency (prebid#1559)
  • Loading branch information
snapwich authored and philipwatson committed Sep 18, 2017
1 parent d678bfa commit 424d07a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cpmBucketManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function getCpmTarget(cpm, increment, precision, granularityMultiplier) {
if (!precision) {
precision = _defaultPrecision;
}
let bucketSize = 1 / increment * granularityMultiplier;
let bucketSize = 1 / (increment * granularityMultiplier);
return (Math.floor(cpm * bucketSize) / bucketSize).toFixed(precision);
}

Expand Down
2 changes: 1 addition & 1 deletion test/spec/cpmBucketManager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('cpmBucketManager', () => {
}
]
};
let expected = '{"low":"552.45","med":"1824.09","high":"1824.09","auto":"1824.09","dense":"1824.09","custom":"1824.0882"}';
let expected = '{"low":"552.45","med":"1823.09","high":"1823.09","auto":"1823.09","dense":"1823.09","custom":"1823.0850"}';
let output = getPriceBucketString(cpm, customConfig, 110.49);
expect(JSON.stringify(output)).to.deep.equal(expected);
});
Expand Down

0 comments on commit 424d07a

Please sign in to comment.