Skip to content

Commit 059837f

Browse files
Merge branch 'master' into muzahid/FSSDK-11374
* master: [FSSDK-11373] add holdout support and refactor decision logic in DefaultDecisionService (#587) # Conflicts: # OptimizelySwiftSDK.xcodeproj/project.pbxproj # Sources/Implementation/DefaultDecisionService.swift # Sources/Protocols/OPTBucketer.swift # Tests/OptimizelyTests-DataModel/HoldoutTests.swift
2 parents 93090fc + 51b0387 commit 059837f

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

Sources/Implementation/DefaultDecisionService.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,12 @@ class DefaultDecisionService: OPTDecisionService {
431431
logger.i(info)
432432

433433
// bucket user into holdout variation
434-
let decisionResponse = bucketer.bucketToVariation(experiment: holdout, bucketingId: bucketingId)
435-
436-
reasons.merge(decisionResponse.reasons)
434+
let decisionResponse = (bucketer as? DefaultBucketer)?.bucketToVariation(experiment: holdout, bucketingId: bucketingId)
435+
if let reason = decisionResponse?.reasons {
436+
reasons.merge(reason)
437+
}
437438

438-
bucketedVariation = decisionResponse.result
439+
bucketedVariation = decisionResponse?.result
439440

440441
if let variation = bucketedVariation {
441442
let info = LogMessage.userBucketedIntoVariationInHoldout(userId, holdout.key, variation.key)

Sources/Protocols/OPTBucketer.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ protocol OPTBucketer {
3737
experiment: Experiment,
3838
bucketingId: String) -> DecisionResponse<Variation>
3939

40-
/**
41-
Bucket a bucketingId into an experiment.
42-
- Parameter experiment: The rule in which to bucket the bucketingId.
43-
- Parameter bucketingId: The ID to bucket. This must be a non-null, non-empty string.
44-
- Returns: The variation the bucketingId was bucketed into.
45-
*/
46-
func bucketToVariation(experiment: ExperimentCore,
47-
bucketingId: String) -> DecisionResponse<Variation>
48-
4940
/**
5041
Hash the bucketing ID and map it to the range [0, 10000).
5142
- Parameter bucketingId: The ID for which to generate the hash and bucket values.

0 commit comments

Comments
 (0)