Skip to content

Commit 875cde2

Browse files
[FSSDK-11546] type adjustment
1 parent d262bdb commit 875cde2

File tree

6 files changed

+21
-27
lines changed

6 files changed

+21
-27
lines changed

OptimizelySDK/Entity/Experiment.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ public class Experiment : ExperimentCore
2727
/// </summary>
2828
public string GroupId { get; set; }
2929

30-
/// <summary>
31-
/// Layer ID for the experiment
32-
/// </summary>
33-
public string LayerId { get; set; }
34-
3530
/// <summary>
3631
/// ForcedVariations for the experiment
3732
/// </summary>
@@ -53,12 +48,6 @@ public class Experiment : ExperimentCore
5348
public bool IsInMutexGroup =>
5449
!string.IsNullOrEmpty(GroupPolicy) && GroupPolicy == MUTEX_GROUP_POLICY;
5550

56-
/// <summary>
57-
/// Determine if experiment is running or not
58-
/// </summary>
59-
public bool IsExperimentRunning =>
60-
!string.IsNullOrEmpty(Status) && Status == STATUS_RUNNING;
61-
6251
/// <summary>
6352
/// Determin if user is forced variation of experiment
6453
/// </summary>
@@ -68,10 +57,5 @@ public bool IsUserInForcedVariation(string userId)
6857
{
6958
return ForcedVariations != null && ForcedVariations.ContainsKey(userId);
7059
}
71-
72-
/// <summary>
73-
/// Determine if experiment is currently activated/running (implementation of abstract property)
74-
/// </summary>
75-
public override bool IsActivated => IsExperimentRunning;
7660
}
7761
}

OptimizelySDK/Entity/ExperimentCore.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public abstract class ExperimentCore : IdKeyEntity
3535
/// </summary>
3636
public string Status { get; set; }
3737

38+
/// <summary>
39+
/// Layer ID for the experiment
40+
/// </summary>
41+
public virtual string LayerId { get; set; }
42+
3843
/// <summary>
3944
/// Variations for the experiment/holdout
4045
/// </summary>
@@ -269,8 +274,11 @@ public virtual Variation GetVariationByKey(string key)
269274
#endregion
270275

271276
/// <summary>
272-
/// Determine if experiment/holdout is currently activated/running
277+
/// Determine if experiment is currently activated/running
273278
/// </summary>
274-
public abstract bool IsActivated { get; }
279+
public bool IsExperimentRunning =>
280+
!string.IsNullOrEmpty(Status) && Status == STATUS_RUNNING;
281+
282+
public bool IsActivated => IsExperimentRunning;
275283
}
276284
}

OptimizelySDK/Entity/Holdout.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ public enum HoldoutStatus
4545
public string[] ExcludedFlags { get; set; } = new string[0];
4646

4747
/// <summary>
48-
/// Determine if holdout is currently activated/running
48+
/// Layer ID is always empty for holdouts as they don't belong to any layer
4949
/// </summary>
50-
public override bool IsActivated =>
51-
!string.IsNullOrEmpty(Status) && Status == STATUS_RUNNING;
52-
50+
public override string LayerId
51+
{
52+
get => string.Empty;
53+
set { /* Holdouts don't have layer IDs, ignore any assignment */ }
54+
}
5355
}
5456
}

OptimizelySDK/Event/Entity/ImpressionEvent.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ImpressionEvent : UserEvent
2828
public string UserId { get; private set; }
2929
public VisitorAttribute[] VisitorAttributes { get; private set; }
3030

31-
public Experiment Experiment { get; set; }
31+
public ExperimentCore Experiment { get; set; }
3232
public DecisionMetadata Metadata { get; set; }
3333
public Variation Variation { get; set; }
3434
public bool? BotFiltering { get; set; }
@@ -42,7 +42,7 @@ public class Builder
4242
private EventContext EventContext;
4343

4444
public VisitorAttribute[] VisitorAttributes;
45-
private Experiment Experiment;
45+
private ExperimentCore Experiment;
4646
private Variation Variation;
4747
private DecisionMetadata Metadata;
4848
private bool? BotFiltering;
@@ -61,7 +61,7 @@ public Builder WithEventContext(EventContext eventContext)
6161
return this;
6262
}
6363

64-
public Builder WithExperiment(Experiment experiment)
64+
public Builder WithExperiment(ExperimentCore experiment)
6565
{
6666
Experiment = experiment;
6767

OptimizelySDK/Event/UserEventFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static ImpressionEvent CreateImpressionEvent(ProjectConfig projectConfig,
6161
/// <param name="ruleType">experiment or featureDecision source </param>
6262
/// <returns>ImpressionEvent instance</returns>
6363
public static ImpressionEvent CreateImpressionEvent(ProjectConfig projectConfig,
64-
Experiment activatedExperiment,
64+
ExperimentCore activatedExperiment,
6565
Variation variation,
6666
string userId,
6767
UserAttributes userAttributes,

OptimizelySDK/Optimizely.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ private void SendImpressionEvent(Experiment experiment, Variation variation, str
11541154
/// <param name="userAttributes">The user's attributes</param>
11551155
/// <param name="flagKey">It can either be experiment key in case if ruleType is experiment or it's feature key in case ruleType is feature-test or rollout</param>
11561156
/// <param name="ruleType">It can either be experiment in case impression event is sent from activate or it's feature-test or rollout</param>
1157-
private bool SendImpressionEvent(Experiment experiment, Variation variation, string userId,
1157+
private bool SendImpressionEvent(ExperimentCore experiment, Variation variation, string userId,
11581158
UserAttributes userAttributes, ProjectConfig config,
11591159
string flagKey, string ruleType, bool enabled
11601160
)

0 commit comments

Comments
 (0)