Skip to content

Commit

Permalink
preferred deal win over anything else when preferred deals flag is off (
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumitru-Radu Barbos authored and GitHub Enterprise committed Jun 20, 2024
1 parent d0fb7bd commit 79e27f0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions exchange/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ func defaultAuction(adapterBids map[openrtb_ext.BidderName]*entities.PbsOrtbSeat

// isNewWinningBid calculates if the new bid (nbid) will win against the current winning bid (wbid) given preferDeals.
func isNewWinningBid(bidWrapper, wbidWrapper *entities.PbsOrtbBid, preferDeals bool) bool {
if bidWrapper.DealWinPriority > wbidWrapper.DealWinPriority {
return true
} else if bidWrapper.DealWinPriority < wbidWrapper.DealWinPriority {
return false
}
var (
bid = bidWrapper.Bid
wbid = wbidWrapper.Bid
Expand All @@ -184,13 +189,6 @@ func isNewWinningBid(bidWrapper, wbidWrapper *entities.PbsOrtbBid, preferDeals b
if len(wbid.DealID) == 0 && len(bid.DealID) > 0 {
return true
}
if len(bid.DealID) > 0 && len(wbid.DealID) > 0 {
if bidWrapper.DealWinPriority > wbidWrapper.DealWinPriority {
return true
} else if bidWrapper.DealWinPriority < wbidWrapper.DealWinPriority {
return false
}
}
}
return bid.Price > wbid.Price
}
Expand Down

0 comments on commit 79e27f0

Please sign in to comment.