Skip to content

Commit 95895a1

Browse files
authoredNov 22, 2024··
Floors: Modify fetchrate to usefetchdatarate (#3972)
1 parent 2099424 commit 95895a1

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed
 

‎floors/fetcher.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ func validateRules(config config.AccountFloorFetch, priceFloors *openrtb_ext.Pri
309309
return errors.New("skip rate should be greater than or equal to 0 and less than 100")
310310
}
311311

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

316316
for _, modelGroup := range priceFloors.Data.ModelGroups {

‎floors/fetcher_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ func TestValidatePriceFloorRules(t *testing.T) {
398398
wantErr: true,
399399
},
400400
{
401-
name: "Invalid FetchRate",
401+
name: "Invalid UseFetchDataRate",
402402
args: args{
403403
configs: config.AccountFloorFetch{
404404
Enabled: true,
@@ -417,7 +417,7 @@ func TestValidatePriceFloorRules(t *testing.T) {
417417
"*|*|www.website.com": 15.01,
418418
},
419419
}},
420-
FetchRate: ptrutil.ToPtr(-11),
420+
UseFetchDataRate: ptrutil.ToPtr(-11),
421421
},
422422
},
423423
},

‎floors/floors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func resolveFloors(account config.Account, bidRequestWrapper *openrtb_ext.Reques
166166
fetchResult, fetchStatus = priceFloorFetcher.Fetch(account.PriceFloors)
167167
}
168168

169-
if fetchResult != nil && fetchStatus == openrtb_ext.FetchSuccess && useFetchedData(fetchResult.Data.FetchRate) {
169+
if fetchResult != nil && fetchStatus == openrtb_ext.FetchSuccess && useFetchedData(fetchResult.Data.UseFetchDataRate) {
170170
mergedFloor := mergeFloors(reqFloor, fetchResult, conversions)
171171
floorRules, errList = createFloorsFrom(mergedFloor, account, fetchStatus, openrtb_ext.FetchLocation)
172172
} else if reqFloor != nil {

‎floors/floors_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ func (m *MockFetchDataRate0) Fetch(configs config.AccountPriceFloors) (*openrtb_
791791
},
792792
},
793793
},
794-
FetchRate: ptrutil.ToPtr(0),
794+
UseFetchDataRate: ptrutil.ToPtr(0),
795795
},
796796
}
797797
return &priceFloors, openrtb_ext.FetchSuccess
@@ -831,7 +831,7 @@ func (m *MockFetchDataRate100) Fetch(configs config.AccountPriceFloors) (*openrt
831831
},
832832
},
833833
},
834-
FetchRate: ptrutil.ToPtr(100),
834+
UseFetchDataRate: ptrutil.ToPtr(100),
835835
},
836836
}
837837
return &priceFloors, openrtb_ext.FetchSuccess
@@ -979,7 +979,7 @@ func TestResolveFloorsWithUseDataRate(t *testing.T) {
979979
},
980980
},
981981
},
982-
FetchRate: ptrutil.ToPtr(100),
982+
UseFetchDataRate: ptrutil.ToPtr(100),
983983
},
984984
},
985985
},

‎openrtb_ext/floors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ type PriceFloorData struct {
8989
ModelTimestamp int `json:"modeltimestamp,omitempty"`
9090
ModelGroups []PriceFloorModelGroup `json:"modelgroups,omitempty"`
9191
FloorProvider string `json:"floorprovider,omitempty"`
92-
FetchRate *int `json:"fetchrate,omitempty"`
92+
UseFetchDataRate *int `json:"usefetchdatarate,omitempty"`
9393
}
9494

9595
type PriceFloorModelGroup struct {

0 commit comments

Comments
 (0)
Please sign in to comment.