Skip to content

Commit

Permalink
Minor corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
adams85 committed Feb 6, 2024
1 parent e779937 commit fb6bab8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/ConfigCatClient/Evaluation/RolloutEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private EvaluateResult EvaluateSetting(ref EvaluateContext context)
}

var percentageOptions = context.Setting.PercentageOptions;
if (percentageOptions.Length > 0 && TryEvaluatePercentageOptions(percentageOptions, targetingRule: null, ref context, out evaluateResult))
if (percentageOptions.Length > 0 && TryEvaluatePercentageOptions(percentageOptions, matchedTargetingRule: null, ref context, out evaluateResult))
{
return evaluateResult;
}
Expand Down Expand Up @@ -173,7 +173,7 @@ private bool TryEvaluateTargetingRules(TargetingRule[] targetingRules, ref Evalu
return false;
}

private bool TryEvaluatePercentageOptions(PercentageOption[] percentageOptions, TargetingRule? targetingRule, ref EvaluateContext context, out EvaluateResult result)
private bool TryEvaluatePercentageOptions(PercentageOption[] percentageOptions, TargetingRule? matchedTargetingRule, ref EvaluateContext context, out EvaluateResult result)
{
var logBuilder = context.LogBuilder;

Expand Down Expand Up @@ -244,10 +244,13 @@ private bool TryEvaluatePercentageOptions(PercentageOption[] percentageOptions,
continue;
}

var percentageOptionValue = percentageOption.Value.GetValue(throwIfInvalid: false);
logBuilder?.NewLine().Append($"- Hash value {hashValue} selects % option {i + 1} ({percentageOption.Percentage}%), '{percentageOptionValue ?? EvaluateLogHelper.InvalidValuePlaceholder}'.");
if (logBuilder is not null)
{
var percentageOptionValue = percentageOption.Value.GetValue(throwIfInvalid: false) ?? EvaluateLogHelper.InvalidValuePlaceholder;
logBuilder.NewLine().Append($"- Hash value {hashValue} selects % option {i + 1} ({percentageOption.Percentage}%), '{percentageOptionValue}'.");
}

result = new EvaluateResult(percentageOption, matchedTargetingRule: targetingRule, matchedPercentageOption: percentageOption);
result = new EvaluateResult(percentageOption, matchedTargetingRule, percentageOption);
return true;
}

Expand Down

0 comments on commit fb6bab8

Please sign in to comment.