1
1
/*
2
- * Copyright 2017-2023 , Optimizely
2
+ * Copyright 2017-2024 , Optimizely
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use file except in compliance with the License.
@@ -573,8 +573,7 @@ public virtual bool IsFeatureEnabled(string featureKey, string userId,
573
573
else
574
574
{
575
575
Logger . Log ( LogLevel . INFO ,
576
- $@ "The user ""{ userId } "" is not being experimented on feature ""{ featureKey
577
- } "".") ;
576
+ $@ "The user ""{ userId } "" is not being experimented on feature ""{ featureKey } "".") ;
578
577
}
579
578
}
580
579
@@ -624,8 +623,7 @@ public virtual T GetFeatureVariableValueForType<T>(string featureKey, string var
624
623
if ( config == null )
625
624
{
626
625
Logger . Log ( LogLevel . ERROR ,
627
- $@ "Datafile has invalid format. Failing '{
628
- FeatureVariable . GetFeatureVariableTypeName ( variableType ) } '." ) ;
626
+ $@ "Datafile has invalid format. Failing '{ FeatureVariable . GetFeatureVariableTypeName ( variableType ) } '.") ;
629
627
return default ;
630
628
}
631
629
@@ -649,15 +647,13 @@ public virtual T GetFeatureVariableValueForType<T>(string featureKey, string var
649
647
if ( featureVariable == null )
650
648
{
651
649
Logger . Log ( LogLevel . ERROR ,
652
- $@ "No feature variable was found for key ""{ variableKey } "" in feature flag ""{
653
- featureKey } ""." ) ;
650
+ $@ "No feature variable was found for key ""{ variableKey } "" in feature flag ""{ featureKey } "".") ;
654
651
return default ;
655
652
}
656
653
else if ( featureVariable . Type != variableType )
657
654
{
658
655
Logger . Log ( LogLevel . ERROR ,
659
- $@ "Variable is of type ""{ featureVariable . Type
660
- } "", but you requested it as type ""{ variableType } "".") ;
656
+ $@ "Variable is of type ""{ featureVariable . Type } "", but you requested it as type ""{ variableType } "".") ;
661
657
return default ;
662
658
}
663
659
@@ -681,28 +677,24 @@ public virtual T GetFeatureVariableValueForType<T>(string featureKey, string var
681
677
{
682
678
variableValue = featureVariableUsageInstance . Value ;
683
679
Logger . Log ( LogLevel . INFO ,
684
- $@ "Got variable value ""{ variableValue } "" for variable ""{ variableKey
685
- } "" of feature flag ""{ featureKey } "".") ;
680
+ $@ "Got variable value ""{ variableValue } "" for variable ""{ variableKey } "" of feature flag ""{ featureKey } "".") ;
686
681
}
687
682
else
688
683
{
689
684
Logger . Log ( LogLevel . INFO ,
690
- $@ "Feature ""{ featureKey } "" is not enabled for user { userId
691
- } . Returning the default variable value ""{ variableValue } "".") ;
685
+ $@ "Feature ""{ featureKey } "" is not enabled for user { userId } . Returning the default variable value ""{ variableValue } "".") ;
692
686
}
693
687
}
694
688
else
695
689
{
696
690
Logger . Log ( LogLevel . INFO ,
697
- $@ "Variable ""{ variableKey } "" is not used in variation ""{ variation . Key
698
- } "", returning default value ""{ variableValue } "".") ;
691
+ $@ "Variable ""{ variableKey } "" is not used in variation ""{ variation . Key } "", returning default value ""{ variableValue } "".") ;
699
692
}
700
693
}
701
694
else
702
695
{
703
696
Logger . Log ( LogLevel . INFO ,
704
- $@ "User ""{ userId } "" is not in any variation for feature flag ""{ featureKey
705
- } "", returning default value ""{ variableValue } "".") ;
697
+ $@ "User ""{ userId } "" is not in any variation for feature flag ""{ featureKey } "", returning default value ""{ variableValue } "".") ;
706
698
}
707
699
708
700
var sourceInfo = new Dictionary < string , string > ( ) ;
@@ -951,12 +943,12 @@ internal Dictionary<string, OptimizelyDecision> DecideForKeys(OptimizelyUserCont
951
943
952
944
var decisionReasons = new DecisionReasons ( ) ;
953
945
decisionReasonsMap . Add ( key , decisionReasons ) ;
954
-
946
+
955
947
var optimizelyDecisionContext = new OptimizelyDecisionContext ( key ) ;
956
948
var forcedDecisionVariation =
957
949
DecisionService . ValidatedForcedDecision ( optimizelyDecisionContext , projectConfig , user ) ;
958
950
decisionReasons += forcedDecisionVariation . DecisionReasons ;
959
-
951
+
960
952
if ( forcedDecisionVariation . ResultObject != null )
961
953
{
962
954
flagDecisions . Add ( key , new FeatureDecision ( null ,
@@ -1040,7 +1032,7 @@ ProjectConfig projectConfig
1040
1032
decisionSource = flagDecision . Source ;
1041
1033
}
1042
1034
1043
- var includeReasons = allOptions . Contains ( OptimizelyDecideOption . INCLUDE_REASONS ) ;
1035
+ var includeReasons = allOptions . Contains ( OptimizelyDecideOption . INCLUDE_REASONS ) ;
1044
1036
var reasonsToReport = decisionReasons . ToReport ( includeReasons ) . ToArray ( ) ;
1045
1037
var variationKey = flagDecision . Variation ? . Key ;
1046
1038
// TODO: add ruleKey values when available later. use a copy of experimentKey until then.
@@ -1071,8 +1063,8 @@ ProjectConfig projectConfig
1071
1063
{ "reasons" , reasonsToReport } ,
1072
1064
{ "decisionEventDispatched" , decisionEventDispatched } ,
1073
1065
} ;
1074
-
1075
- NotificationCenter . SendNotifications ( NotificationCenter . NotificationType . Decision ,
1066
+
1067
+ NotificationCenter . SendNotifications ( NotificationCenter . NotificationType . Decision ,
1076
1068
DecisionNotificationTypes . FLAG , userId , user . GetAttributes ( ) , decisionInfo ) ;
1077
1069
1078
1070
return new OptimizelyDecision (
@@ -1114,7 +1106,7 @@ private Result<Dictionary<string, object>> GetDecisionVariableMap(FeatureFlag fl
1114
1106
1115
1107
valuesMap [ variable . Key ] = convertedValue ;
1116
1108
}
1117
-
1109
+
1118
1110
return Result < Dictionary < string , object > > . NewResult ( valuesMap , reasons ) ;
1119
1111
}
1120
1112
0 commit comments