Skip to content

Commit

Permalink
fixed nbr getting set to 502 for adpod bids
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-nikhil-vaidya committed Feb 29, 2024
1 parent dfc622f commit 90fbc6a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
22 changes: 18 additions & 4 deletions modules/pubmatic/openwrap/middleware/adpod/openrtb.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,26 @@ func getPrebidCTVSeatBid(bidsMap map[string][]openrtb2.Bid) []openrtb2.SeatBid {
creative, price := getAdPodBidCreativeAndPrice(bids)
bid.AdM = creative
bid.Price = price
if len(bids) > 0 {
bid.Cat = bids[0].Cat
bid.ADomain = bids[0].ADomain
}
bid.ImpID = impId

// Get Categories and ad domain
category := make(map[string]bool)
addomain := make(map[string]bool)
for _, eachBid := range bids {
for _, cat := range eachBid.Cat {
if _, ok := category[cat]; !ok {
category[cat] = true
bid.Cat = append(bid.Cat, cat)
}
}
for _, domain := range eachBid.ADomain {
if _, ok := addomain[domain]; !ok {
addomain[domain] = true
bid.ADomain = append(bid.ADomain, domain)
}
}
}

seatBid := openrtb2.SeatBid{}
seatBid.Seat = models.BidderOWPrebidCTV
seatBid.Bid = append(seatBid.Bid, bid)
Expand Down
9 changes: 7 additions & 2 deletions modules/pubmatic/openwrap/nonbids.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,18 @@ func addLostToDealBidNonBRCode(rctx *models.RequestCtx) {
return
}

for impID := range rctx.ImpBidCtx {
for impID, impCtx := range rctx.ImpBidCtx {
// Do not update the nbr in case of adpod bids
if impCtx.AdpodConfig != nil {
continue
}

_, ok := rctx.WinningBids[impID]
if !ok {
continue
}

for bidID, bidCtx := range rctx.ImpBidCtx[impID].BidCtx {
for bidID, bidCtx := range impCtx.BidCtx {
// do not update NonBR for winning bid
if rctx.WinningBids.IsWinningBid(impID, bidID) {
continue
Expand Down

0 comments on commit 90fbc6a

Please sign in to comment.