Skip to content
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

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

Merged
merged 2 commits into from
Feb 26, 2020

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