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

Restore return format of bidsBackHandler callback #371

Merged
merged 10 commits into from
May 31, 2016

Conversation

protonate
Copy link
Collaborator

A groupByPlacement reduce function transforms the bids received array to a map which is passed to the bidsBackHandler callback. This restores behavior to pre-v0.9.1.

@@ -249,12 +249,37 @@ function processCallbacks(callbackQueue) {
if (utils.isArray(callbackQueue)) {
for (i = 0; i < callbackQueue.length; i++) {
var func = callbackQueue[i];
func.call(pbjs, pbjs._bidsReceived);
func.call(pbjs, pbjs._bidsReceived.reduce(groupByPlacement, {}));
Copy link
Member

Choose a reason for hiding this comment

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

@protonate
Is there a way to reduce _bidsReceived by the requestId on this request? With this implementation we get an expanding list of bids back each time a requestBids is fired...

@protonate
Copy link
Collaborator Author

@mkendall07 ready for review & test

@@ -32,8 +32,10 @@ var eventValidators = {

/* Public vars */

pbjs._auctionRunning = false;
Copy link
Member

@mkendall07 mkendall07 May 26, 2016

Choose a reason for hiding this comment

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

do we want to put this in pbjs? They can reset this flag to force a new request without clearing the other globals... edit: nvm, implementation works.

const requestId = utils.getUniqueIdentifierStr();
adUnitCodes = adUnitCodes || getBidderCodes();

getBidderCodes().forEach(bidderCode => {
Copy link
Member

Choose a reason for hiding this comment

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

Replace with adUnitCodes

@protonate protonate force-pushed the bugfix/bids-back-data-structure branch from eacbb65 to 5653026 Compare May 27, 2016 23:21
@mkendall07
Copy link
Member

LGTM. Thanks @protonate

@mkendall07 mkendall07 merged commit bf06c0b into master May 31, 2016
auctionRunning = true;
pbjs._bidsRequested = [];
pbjs._bidsReceived = [];
resetPresetTargeting();
Copy link
Member

Choose a reason for hiding this comment

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

@protonate
I think it makes sense to move this into the setTargetingForGPTAsync function, because this is GPT specific code. Thoughts?

@protonate protonate deleted the bugfix/bids-back-data-structure branch May 31, 2016 18:51
protonate pushed a commit that referenced this pull request Jun 15, 2016
* a `groupByPlacement` reduce function transforms the bids received array to a map

* prevent concurrent bid requests

If an auction is running don't accept a new request for bids..
This adds a `clearAuction` function to set `auctionRunning` false and to clear `_bidsRequested` and `_bidsReceived`. This is a stopgap measure util #353

* clear data structures on additional bid request

* make auctionRunning private and allow passing adUnits to requestBids

* pass adUnitCodes on refresh bids

* use adUnitCodes if passed in to requestBids, otherwise `getBidderCodes()`, disambiguate `bidmanager.getBidderCode`

* restore use of adUnitCodes to filter adUnits

* cherrypick reset targeting merged

* clear targeting fixes and test mock

* Add GptPubadsDefined check
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