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

OTT-172: Set Default min Ads value to 1 from 2 #161

Merged
merged 2 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion endpoints/events/vtrack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ func TestGetVideoEventTracking(t *testing.T) {
name: "valid_scenario",
args: args{
trackerURL: "http://company.tracker.com?eventId=[EVENT_ID]&appbundle=[DOMAIN]",
bid: &openrtb2.Bid{
bid: &openrtb2.Bid{
// AdM: vastXMLWith2Creatives,
},
req: &openrtb2.BidRequest{
Expand Down
2 changes: 1 addition & 1 deletion endpoints/openrtb2/ctv/impressions/impression_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func computeTimeForEachAdSlot(cfg generator, totalAds int64) int64 {
// of given number. Prefer to return computed timeForEachSlot
// In such case timeForEachSlot no necessarily to be multiples of given number
if cfg.requested.slotMinDuration == cfg.requested.slotMaxDuration {
util.Logf("requested.slotMinDuration = requested.slotMinDuration = %v. Hence, not computing multiples of %v value.", cfg.requested.slotMaxDuration, multipleOf)
util.Logf("requested.slotMinDuration = requested.slotMaxDuration = %v. Hence, not computing multiples of %v value.", cfg.requested.slotMaxDuration, multipleOf)
return timeForEachSlot
}

Expand Down
25 changes: 25 additions & 0 deletions endpoints/openrtb2/ctv/impressions/maximize_for_duration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,31 @@ var impressionsTests = []struct {
closedMaxDuration: 74,
closedSlotMinDuration: 12,
closedSlotMaxDuration: 12,
}}, {scenario: "TC56", out: expected{
impressionCount: 1,
freeTime: 0, closedMinDuration: 126,
closedMaxDuration: 126,
closedSlotMinDuration: 126,
closedSlotMaxDuration: 126,
}}, {scenario: "TC57", out: expected{
impressionCount: 1,
freeTime: 0, closedMinDuration: 126,
closedMaxDuration: 126,
closedSlotMinDuration: 126,
closedSlotMaxDuration: 126,
}}, {scenario: "TC58", out: expected{
impressionCount: 4,
freeTime: 0, closedMinDuration: 30,
closedMaxDuration: 90,
closedSlotMinDuration: 15,
closedSlotMaxDuration: 45,
}},
{scenario: "TC59", out: expected{
impressionCount: 1,
freeTime: 45, closedMinDuration: 30,
closedMaxDuration: 90,
closedSlotMinDuration: 15,
closedSlotMaxDuration: 45,
}},
}

Expand Down
29 changes: 28 additions & 1 deletion endpoints/openrtb2/ctv/impressions/min_max_algorithm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,34 @@ var impressionsTestsA2 = []struct {
step4: [][2]int64{},
step5: [][2]int64{},
}},

{scenario: "TC56", out: expectedOutputA2{
step1: [][2]int64{{126, 126}},
step2: [][2]int64{{126, 126}},
step3: [][2]int64{{126, 126}},
step4: [][2]int64{{126, 126}},
step5: [][2]int64{{126, 126}},
}},
{scenario: "TC57", out: expectedOutputA2{
step1: [][2]int64{{126, 126}},
step2: [][2]int64{},
step3: [][2]int64{{126, 126}},
step4: [][2]int64{},
step5: [][2]int64{{126, 126}},
}},
{scenario: "TC58", out: expectedOutputA2{
step1: [][2]int64{{25, 25}, {25, 25}, {20, 20}, {20, 20}},
step2: [][2]int64{{25, 25}, {25, 25}, {20, 20}, {20, 20}},
step3: [][2]int64{{45, 45}, {45, 45}},
step4: [][2]int64{},
step5: [][2]int64{{15, 15}, {15, 15}},
}},
{scenario: "TC59", out: expectedOutputA2{
step1: [][2]int64{{45, 45}},
step2: [][2]int64{},
step3: [][2]int64{},
step4: [][2]int64{{30, 30}},
step5: [][2]int64{{30, 30}},
}},
// {scenario: "TC1" , out: expectedOutputA2{
// step1: [][2]int64{},
// step2: [][2]int64{},
Expand Down
4 changes: 4 additions & 0 deletions endpoints/openrtb2/ctv/impressions/testdata/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ var Input = map[string][]int{
"TC52": {68, 72, 12, 18, 2, 4},
"TC53": {126, 126, 1, 20, 1, 7},
"TC55": {1, 74, 12, 12, 1, 6},
"TC56": {126, 126, 126, 126, 1, 1},
"TC57": {126, 126, 126, 126, 1, 3},
"TC58": {30, 90, 15, 45, 2, 4},
"TC59": {30, 90, 15, 45, 1, 1},
}
16 changes: 16 additions & 0 deletions endpoints/openrtb2/ctv/impressions/testdata/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,20 @@ var Scenario = map[string]eout{
MaximizeForDuration: [][2]int64{{12, 12}, {12, 12}, {12, 12}, {12, 12}, {12, 12}, {12, 12}},
MinMaxAlgorithm: [][2]int64{{12, 12}, {12, 12}, {12, 12}, {12, 12}, {12, 12}, {12, 12}},
},
"TC56": {
MaximizeForDuration: [][2]int64{{126, 126}},
MinMaxAlgorithm: [][2]int64{{126, 126}},
},
"TC57": {
MaximizeForDuration: [][2]int64{{126, 126}},
MinMaxAlgorithm: [][2]int64{{126, 126}},
},
"TC58": {
MaximizeForDuration: [][2]int64{{25, 25}, {25, 25}, {20, 20}, {20, 20}},
MinMaxAlgorithm: [][2]int64{{15, 15}, {15, 15}, {15, 20}, {15, 20}, {15, 25}, {15, 25}, {15, 45}, {15, 45}},
},
"TC59": {
MaximizeForDuration: [][2]int64{{45, 45}},
MinMaxAlgorithm: [][2]int64{{30, 30}, {30, 45}},
},
}
2 changes: 1 addition & 1 deletion endpoints/openrtb2/ctv_auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewCTVEndpoint(
requestsByID stored_requests.Fetcher,
videoFetcher stored_requests.Fetcher,
accounts stored_requests.AccountFetcher,
//categories stored_requests.CategoryFetcher,
//categories stored_requests.CategoryFetcher,
cfg *config.Configuration,
met metrics.MetricsEngine,
pbsAnalytics analytics.PBSAnalyticsModule,
Expand Down
2 changes: 1 addition & 1 deletion exchange/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func NewExchange(adapters map[openrtb_ext.BidderName]adaptedBidder, cache prebid
LMT: cfg.LMT,
},
bidIDGenerator: &bidIDGenerator{cfg.GenerateBidID},
trakerURL: cfg.TrackerURL,
trakerURL: cfg.TrackerURL,
}
}

Expand Down
2 changes: 1 addition & 1 deletion exchange/targeting.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ func (targData *targetData) addBidderKeys(keys map[string]string, bidderKeys map
keys[index] = element
}
}
}
}
2 changes: 1 addition & 1 deletion openrtb_ext/adpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (ext *ExtVideoAdPod) Validate() (err []error) {
func (pod *VideoAdPod) SetDefaultValue() {
//pod.MinAds setting default value
if nil == pod.MinAds {
pod.MinAds = getIntPtr(2)
pod.MinAds = getIntPtr(1)
}

//pod.MaxAds setting default value
Expand Down
2 changes: 1 addition & 1 deletion router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func New(cfg *config.Configuration, rateConvertor *currency.RateConverter) (r *R
if err := validateDefaultAliases(defaultAliases); err != nil {
glog.Fatal(err)
}

g_defReqJSON = defReqJSON

g_syncers = usersyncers.NewSyncerMap(cfg)
Expand Down