Skip to content

Commit

Permalink
Floors: Modify fetchrate to usefetchdatarate (#3972)
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-nikhil-vaidya authored Nov 22, 2024
1 parent 2099424 commit 95895a1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions floors/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ func validateRules(config config.AccountFloorFetch, priceFloors *openrtb_ext.Pri
return errors.New("skip rate should be greater than or equal to 0 and less than 100")
}

if priceFloors.Data.FetchRate != nil && (*priceFloors.Data.FetchRate < dataRateMin || *priceFloors.Data.FetchRate > dataRateMax) {
return errors.New("FetchRate should be greater than or equal to 0 and less than or equal to 100")
if priceFloors.Data.UseFetchDataRate != nil && (*priceFloors.Data.UseFetchDataRate < dataRateMin || *priceFloors.Data.UseFetchDataRate > dataRateMax) {
return errors.New("usefetchdatarate should be greater than or equal to 0 and less than or equal to 100")
}

for _, modelGroup := range priceFloors.Data.ModelGroups {
Expand Down
4 changes: 2 additions & 2 deletions floors/fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func TestValidatePriceFloorRules(t *testing.T) {
wantErr: true,
},
{
name: "Invalid FetchRate",
name: "Invalid UseFetchDataRate",
args: args{
configs: config.AccountFloorFetch{
Enabled: true,
Expand All @@ -417,7 +417,7 @@ func TestValidatePriceFloorRules(t *testing.T) {
"*|*|www.website.com": 15.01,
},
}},
FetchRate: ptrutil.ToPtr(-11),
UseFetchDataRate: ptrutil.ToPtr(-11),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion floors/floors.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func resolveFloors(account config.Account, bidRequestWrapper *openrtb_ext.Reques
fetchResult, fetchStatus = priceFloorFetcher.Fetch(account.PriceFloors)
}

if fetchResult != nil && fetchStatus == openrtb_ext.FetchSuccess && useFetchedData(fetchResult.Data.FetchRate) {
if fetchResult != nil && fetchStatus == openrtb_ext.FetchSuccess && useFetchedData(fetchResult.Data.UseFetchDataRate) {
mergedFloor := mergeFloors(reqFloor, fetchResult, conversions)
floorRules, errList = createFloorsFrom(mergedFloor, account, fetchStatus, openrtb_ext.FetchLocation)
} else if reqFloor != nil {
Expand Down
6 changes: 3 additions & 3 deletions floors/floors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ func (m *MockFetchDataRate0) Fetch(configs config.AccountPriceFloors) (*openrtb_
},
},
},
FetchRate: ptrutil.ToPtr(0),
UseFetchDataRate: ptrutil.ToPtr(0),
},
}
return &priceFloors, openrtb_ext.FetchSuccess
Expand Down Expand Up @@ -831,7 +831,7 @@ func (m *MockFetchDataRate100) Fetch(configs config.AccountPriceFloors) (*openrt
},
},
},
FetchRate: ptrutil.ToPtr(100),
UseFetchDataRate: ptrutil.ToPtr(100),
},
}
return &priceFloors, openrtb_ext.FetchSuccess
Expand Down Expand Up @@ -979,7 +979,7 @@ func TestResolveFloorsWithUseDataRate(t *testing.T) {
},
},
},
FetchRate: ptrutil.ToPtr(100),
UseFetchDataRate: ptrutil.ToPtr(100),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion openrtb_ext/floors.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ type PriceFloorData struct {
ModelTimestamp int `json:"modeltimestamp,omitempty"`
ModelGroups []PriceFloorModelGroup `json:"modelgroups,omitempty"`
FloorProvider string `json:"floorprovider,omitempty"`
FetchRate *int `json:"fetchrate,omitempty"`
UseFetchDataRate *int `json:"usefetchdatarate,omitempty"`
}

type PriceFloorModelGroup struct {
Expand Down

0 comments on commit 95895a1

Please sign in to comment.