Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adams85 committed Sep 1, 2023
1 parent cd4b022 commit a9063d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
34 changes: 17 additions & 17 deletions src/ConfigCatClient/Evaluation/EvaluateContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ namespace ConfigCat.Client.Evaluation;

internal struct EvaluateContext
{
public readonly string Key;
public readonly Setting Setting;
public readonly SettingValue DefaultValue;
public readonly User? User;
public readonly IReadOnlyDictionary<string, Setting> Settings;

private IReadOnlyDictionary<string, string>? userAttributes;
public IReadOnlyDictionary<string, string>? UserAttributes => this.userAttributes ??= this.User?.GetAllAttributes();

private List<string>? visitedFlags;
public List<string> VisitedFlags => this.visitedFlags ??= new List<string>();

public bool IsMissingUserObjectLogged;
public bool IsMissingUserObjectAttributeLogged;

public IndentedTextBuilder? LogBuilder;

public EvaluateContext(string key, Setting setting, SettingValue defaultValue, User? user, IReadOnlyDictionary<string, Setting> settings)
{
this.Key = key;
Expand All @@ -26,21 +43,4 @@ public EvaluateContext(string key, Setting setting, ref EvaluateContext dependen
this.visitedFlags = dependentFlagContext.VisitedFlags; // crucial to use the property here to make sure the list is created!
this.LogBuilder = dependentFlagContext.LogBuilder;
}

public readonly string Key;
public readonly Setting Setting;
public readonly SettingValue DefaultValue;
public readonly User? User;
public readonly IReadOnlyDictionary<string, Setting> Settings;

private IReadOnlyDictionary<string, string>? userAttributes;
public IReadOnlyDictionary<string, string>? UserAttributes => this.userAttributes ??= this.User?.GetAllAttributes();

private List<string>? visitedFlags;
public List<string> VisitedFlags => this.visitedFlags ??= new List<string>();

public bool IsMissingUserObjectLogged;
public bool IsMissingUserObjectAttributeLogged;

public IndentedTextBuilder? LogBuilder;
}
4 changes: 2 additions & 2 deletions src/ConfigCatClient/Models/PercentageOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface IPercentageOption : ISettingValueContainer
/// <summary>
/// A number between 0 and 100 that represents a randomly allocated fraction of the users.
/// </summary>
int Percentage { get; }
byte Percentage { get; }
}

internal sealed class PercentageOption : SettingValueContainer, IPercentageOption
Expand All @@ -27,7 +27,7 @@ internal sealed class PercentageOption : SettingValueContainer, IPercentageOptio
#else
[JsonPropertyName("p")]
#endif
public int Percentage { get; set; }
public byte Percentage { get; set; }

public override string ToString()
{
Expand Down

0 comments on commit a9063d0

Please sign in to comment.