From 424d07a0ab818e53f7b050221ea13cc037226cd3 Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Tue, 5 Sep 2017 13:41:32 -0600 Subject: [PATCH] add () for correct order of operations in scaling increments for currency (#1559) --- src/cpmBucketManager.js | 2 +- test/spec/cpmBucketManager_spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpmBucketManager.js b/src/cpmBucketManager.js index 87daa9488ed..f9515994342 100644 --- a/src/cpmBucketManager.js +++ b/src/cpmBucketManager.js @@ -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); } diff --git a/test/spec/cpmBucketManager_spec.js b/test/spec/cpmBucketManager_spec.js index dd810f29b54..f1f7d697397 100644 --- a/test/spec/cpmBucketManager_spec.js +++ b/test/spec/cpmBucketManager_spec.js @@ -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); });