Skip to content

Commit

Permalink
priceFloors: Prevent warning when floor price value is 0 (#10701)
Browse files Browse the repository at this point in the history
* Prevent warning when priceFloor value is 0

* priceFloors: floor price of zero should not cause warnings
  • Loading branch information
PascalSalesch authored Nov 9, 2023
1 parent 6667f33 commit f2e46d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/priceFloors.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ export const addBidResponseHook = timedBidResponseHook('priceFloors', function a
let floorInfo = getFirstMatchingFloor(floorData.data, matchingBidRequest, {...bid, size: [bid.width, bid.height]});

if (!floorInfo.matchingFloor) {
logWarn(`${MODULE_NAME}: unable to determine a matching price floor for bidResponse`, bid);
if (floorInfo.matchingFloor !== 0) logWarn(`${MODULE_NAME}: unable to determine a matching price floor for bidResponse`, bid);
return fn.call(this, adUnitCode, bid, reject);
}

Expand Down
6 changes: 6 additions & 0 deletions test/spec/modules/priceFloors_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,12 @@ describe('the price floors module', function () {
expect(returnedBidResponse).to.not.haveOwnProperty('floorData');
expect(logWarnSpy.calledOnce).to.equal(true);
});
it('if it finds a rule with a floor price of zero it should not call log warn', function () {
_floorDataForAuction[AUCTION_ID] = utils.deepClone(basicFloorConfig);
_floorDataForAuction[AUCTION_ID].data.values = { '*': 0 };
runBidResponse();
expect(logWarnSpy.calledOnce).to.equal(false);
});
it('if it finds a rule and floors should update the bid accordingly', function () {
_floorDataForAuction[AUCTION_ID] = utils.deepClone(basicFloorConfig);
_floorDataForAuction[AUCTION_ID].data.values = { 'banner': 1.0 };
Expand Down

0 comments on commit f2e46d4

Please sign in to comment.