Skip to content

Commit 3bd0bb0

Browse files
committed
fixed decision service
1 parent 1a3aab3 commit 3bd0bb0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

OptimizelySDK.Tests/DecisionServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ public void TestGetVariationForFeatureRolloutAudienceAndTrafficeAllocationCheck(
845845
actualDecision = decisionService.GetVariationForFeatureRollout(featureFlag, optimizelyUserContext4, ProjectConfig);
846846

847847
// Returned decision entity should be null because bucket value exceeds traffic allocation of everyone else rule.
848-
Assert.Null(actualDecision.ResultObject);
848+
Assert.Null(actualDecision.ResultObject?.Variation?.Key);
849849
}
850850

851851
[Test]

OptimizelySDK/Bucketing/DecisionService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ public virtual Result<FeatureDecision> GetVariationForFeatureRollout(FeatureFlag
455455
var decisionResult = GetVariationFromDeliveryRule(config, featureFlag.Key, rolloutRules, index, user);
456456
reasons += decisionResult.DecisionReasons;
457457

458-
if (decisionResult.ResultObject?.Variation != null)
458+
if (decisionResult.ResultObject?.Variation?.Key != null)
459459
{
460460
return Result<FeatureDecision>.NewResult(new FeatureDecision(rolloutRules[index], decisionResult.ResultObject.Variation, FeatureDecision.DECISION_SOURCE_ROLLOUT), reasons);
461461
}
@@ -577,7 +577,7 @@ private Result<FeatureDecision> GetVariationFromDeliveryRule(ProjectConfig confi
577577
Result<Variation> bucketedVariation = null;
578578

579579
// Evaluate if user meets the audience condition of this rollout rule
580-
var doesUserMeetAudienceConditionsResult = ExperimentUtils.DoesUserMeetAudienceConditions(config, rule, attributes, LOGGING_KEY_TYPE_EXPERIMENT, rule.Key, Logger);
580+
var doesUserMeetAudienceConditionsResult = ExperimentUtils.DoesUserMeetAudienceConditions(config, rule, attributes, LOGGING_KEY_TYPE_RULE, rule.Key, Logger);
581581
reasons += doesUserMeetAudienceConditionsResult.DecisionReasons;
582582
if (doesUserMeetAudienceConditionsResult.ResultObject)
583583
{
@@ -599,7 +599,7 @@ private Result<FeatureDecision> GetVariationFromDeliveryRule(ProjectConfig confi
599599
}
600600
else
601601
{
602-
Logger.Log(LogLevel.DEBUG, reasons.AddInfo($"User \"{userId}\" does not meet conditions for targeting rule \"{loggingKey}\"."));
602+
Logger.Log(LogLevel.DEBUG, reasons.AddInfo($"User \"{userId}\" does not meet the conditions for targeting rule \"{loggingKey}\"."));
603603
}
604604

605605
return Result<FeatureDecision>.NewResult(new FeatureDecision(rule, bucketedVariation?.ResultObject, null), skipToEveryoneElse, reasons);
@@ -676,11 +676,11 @@ public virtual Result<FeatureDecision> GetVariationForFeature(FeatureFlag featur
676676

677677
if (decisionResult.ResultObject != null)
678678
{
679-
Logger.Log(LogLevel.INFO, reasons.AddInfo($"User \"{userId}\" is bucketed into a rollout for feature flag \"{featureFlag.Key}\"."));
679+
Logger.Log(LogLevel.INFO, reasons.AddInfo($"The user \"{userId}\" is bucketed into a rollout for feature flag \"{featureFlag.Key}\"."));
680680
return Result<FeatureDecision>.NewResult(decisionResult.ResultObject, reasons);
681681
}
682682

683-
Logger.Log(LogLevel.INFO, reasons.AddInfo($"User \"{userId}\" is not bucketed into a rollout for feature flag \"{featureFlag.Key}\"."));
683+
Logger.Log(LogLevel.INFO, reasons.AddInfo($"The user \"{userId}\" is not bucketed into a rollout for feature flag \"{featureFlag.Key}\"."));
684684
return Result<FeatureDecision>.NullResult(reasons);
685685
}
686686

0 commit comments

Comments
 (0)