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

drop specific code for index adapter #1487

Merged
merged 1 commit into from
Aug 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions src/bidmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,18 @@ function getBidders(bid) {
function bidsBackAdUnit(adUnitCode) {
const requested = $$PREBID_GLOBAL$$._bidsRequested
.map(request => request.bids
.filter(adUnitsFilter.bind(this, $$PREBID_GLOBAL$$._adUnitCodes))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the above line needs to remain in for now -- not related to index bid counting.

Copy link
Member Author

@mkendall07 mkendall07 Aug 14, 2017

Choose a reason for hiding this comment

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

shouldn't the line below take care of filtering? I don't understand the need for the double filter.

i.e adUnitCode is a subset of ._adUnitCodes

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the adUnitsFilter function:

export function adUnitsFilter(filter, bid) {
  return filter.includes((bid && bid.placementCode) || (bid && bid.adUnitCode));
}

so while it does behave somewhat differently by testing for placementCode and adUnitCode your right that the next filter cuts that down to just placementCode. Ok, makes sense.

.filter(bid => bid.placementCode === adUnitCode))
.reduce(flatten, [])
.map(bid => {
return bid.bidder === 'indexExchange'
? bid.sizes.length
: 1;
}).reduce(add, 0);
.reduce(flatten, []).length;

const received = $$PREBID_GLOBAL$$._bidsReceived.filter(bid => bid.adUnitCode === adUnitCode).length;
return requested === received;
}

function add(a, b) {
return a + b;
}

function bidsBackAll() {
const requested = $$PREBID_GLOBAL$$._bidsRequested
.map(request => request.bids)
.reduce(flatten, [])
.filter(adUnitsFilter.bind(this, $$PREBID_GLOBAL$$._adUnitCodes))
.map(bid => {
return bid.bidder === 'indexExchange'
? bid.sizes.length
: 1;
}).reduce((a, b) => a + b, 0);
.filter(adUnitsFilter.bind(this, $$PREBID_GLOBAL$$._adUnitCodes)).length;

const received = $$PREBID_GLOBAL$$._bidsReceived
.filter(adUnitsFilter.bind(this, $$PREBID_GLOBAL$$._adUnitCodes)).length;
Expand Down