Skip to content

Commit

Permalink
refactor: less movement of code as the ref implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mikechu-optimizely committed Oct 8, 2024
1 parent c9047a0 commit dfe1367
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions OptimizelySDK/Bucketing/DecisionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public bool DecisionBatchInProgress
{
SaveToUserProfileService();
}

_decisionBatchInProgress = value;
}
}
Expand Down Expand Up @@ -168,6 +169,13 @@ OptimizelyDecideOption[] options
UserProfileUtil.IsValidUserProfileMap(userProfileMap))
{
_userProfile = UserProfileUtil.ConvertMapToUserProfile(userProfileMap);
decisionVariationResult =
GetStoredVariation(experiment, _userProfile, config);
reasons += decisionVariationResult.DecisionReasons;
if (decisionVariationResult.ResultObject != null)
{
return decisionVariationResult.SetReasons(reasons);
}
}
else if (userProfileMap == null)
{
Expand All @@ -181,17 +189,6 @@ OptimizelyDecideOption[] options
reasons.AddInfo("The UserProfileService returned an invalid map."));
}
}

if (_userProfile != null)
{
decisionVariationResult =
GetStoredVariation(experiment, _userProfile, config);
reasons += decisionVariationResult.DecisionReasons;
if (decisionVariationResult.ResultObject != null)
{
return decisionVariationResult.SetReasons(reasons);
}
}
}
catch (Exception exception)
{
Expand Down

0 comments on commit dfe1367

Please sign in to comment.