Skip to content

Commit

Permalink
Merge pull request prebid#2 in SA/sync-prebid-server from CAP-1467 to…
Browse files Browse the repository at this point in the history
… synacormedia-updates

* commit 'b26ddff10d5a9808cb0af47f5bc486de3bf86ca6':
  CAP-1467 - additional updates for github review
  • Loading branch information
Corey Kress authored and Corey Kress committed Oct 9, 2019
2 parents 0ce2f35 + b26ddff commit 35d1060
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions adapters/synacormedia/synacormedia.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func (a *SynacorMediaAdapter) makeRequest(request *openrtb.BidRequest) (*adapter
var firstExtImp *openrtb_ext.ExtImpSynacormedia = nil

for _, imp := range request.Imp {
_, err := getExtImpObj(&imp)
validImp, err := getExtImpObj(&imp)
if err != nil {
errs = append(errs, err)
Expand Down Expand Up @@ -168,9 +167,13 @@ func (a *SynacorMediaAdapter) MakeBids(internalRequest *openrtb.BidRequest, exte

for _, sb := range bidResp.SeatBid {
for i := range sb.Bid {
var mediaType = getMediaTypeForImp(sb.Bid[i].ImpID, validRequestImps)
if mediaType != openrtb_ext.BidTypeBanner && mediaType != openrtb_ext.BidTypeVideo {
continue
}
bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
Bid: &sb.Bid[i],
BidType: getMediaTypeForImp(sb.Bid[i].ImpID, validRequestImps),
BidType: mediaType,
})
}
}
Expand All @@ -181,10 +184,21 @@ func getMediaTypeForImp(impId string, imps []openrtb.Imp) openrtb_ext.BidType {
mediaType := openrtb_ext.BidTypeBanner
for _, imp := range imps {
if imp.ID == impId {
if imp.Banner == nil && imp.Video != nil {
if imp.Banner != nil {
break
}
if imp.Video != nil {
mediaType = openrtb_ext.BidTypeVideo
break
}
if imp.Native != nil {
mediaType = openrtb_ext.BidTypeNative
break
}
if imp.Audio != nil {
mediaType = openrtb_ext.BidTypeAudio
break
}
return mediaType
}
}
return mediaType
Expand Down

0 comments on commit 35d1060

Please sign in to comment.