Skip to content

fix(bidcaching): filter sizes sent through bidcaching using the current auction ones#48

Merged
pedrolopezmrf merged 2 commits intomarfeel-masterfrom
MRF-66918/fixBidCachingSizes
Feb 26, 2020
Merged

fix(bidcaching): filter sizes sent through bidcaching using the current auction ones#48
pedrolopezmrf merged 2 commits intomarfeel-masterfrom
MRF-66918/fixBidCachingSizes

Conversation

@pedrolopezmrf
Copy link

No description provided.

@pedrolopezmrf pedrolopezmrf changed the title fix(bidcaching): filter sizes sent through bidcaching using the actual ones fix(bidcaching): filter sizes sent through bidcaching using the current auction ones Feb 26, 2020
src/targeting.js Outdated
const bidsToFilter = bidsByReferrer[lastLocation] || filterBidsByAdUnit(bidsReceived);
const currentAuctionSizes = getLastAuctionSizes();

bidsToProcess = bidsToFilter.filter(filterBidsBySizes(currentAuctionSizes));
Copy link

@oscarmarimrf oscarmarimrf Feb 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bidsToProcess = bidsToFilter.filter(filterBidsBySizes(currentAuctionSizes));
bidsToProcess = bidsToFilter.filter(bid => isBidSizeAllowed(bid, allowedSizes));

Comment on lines 61 to 69
export const filterBidsBySizes = (sizesToFilter) => {
const sizesToFilterUnified = sizesToFilter.map(sizes => sizes.join(SIZE_JOINER));

return (bid) => {
const bidSize = [bid.width, bid.height].join(SIZE_JOINER);

return sizesToFilterUnified.includes(bidSize);
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export const isBidSizeAllowed = (bid, allowedSizes) => {
  const allowedSizesNormalized = allowedSizes.map(sizes => sizes.join(SIZE_JOINER));
  const bidSize = [bid.width, bid.height].join(SIZE_JOINER);

  return allowedSizesNormalized.includes(bidSize);
}

@pedrolopezmrf pedrolopezmrf merged commit 4e3ba94 into marfeel-master Feb 26, 2020
@pedrolopezmrf pedrolopezmrf deleted the MRF-66918/fixBidCachingSizes branch February 26, 2020 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments