@@ -811,11 +811,10 @@ internal OptimizelyDecision Decide(OptimizelyUserContext user,
811811 var decisionSource = flagDecisionResult . ResultObject ? . Source ?? FeatureDecision . DECISION_SOURCE_ROLLOUT ;
812812 if ( ! allOptions . Contains ( OptimizelyDecideOption . DISABLE_DECISION_EVENT ) )
813813 {
814- SendImpressionEvent ( flagDecisionResult . ResultObject ? . Experiment , variation , userId , userAttributes , config , key , decisionSource , featureEnabled ) ;
815- decisionEventDispatched = true ;
814+ decisionEventDispatched = SendImpressionEvent ( flagDecisionResult . ResultObject ? . Experiment , variation , userId , userAttributes , config , key , decisionSource , featureEnabled ) ;
816815 }
817816 var decisionReasons = flagDecisionResult . DecisionReasons ;
818- var reasonsToReport = decisionReasons . ToReport ( allOptions . Contains ( OptimizelyDecideOption . INCLUDE_REASONS ) ) ;
817+ var reasonsToReport = decisionReasons . ToReport ( allOptions . Contains ( OptimizelyDecideOption . INCLUDE_REASONS ) ) . ToArray ( ) ;
819818 var variationKey = flagDecisionResult . ResultObject ? . Variation ? . Key ;
820819
821820 // TODO: add ruleKey values when available later. use a copy of experimentKey until then.
@@ -828,7 +827,7 @@ internal OptimizelyDecision Decide(OptimizelyUserContext user,
828827 { "variables" , variableMap } ,
829828 { "variationKey" , variationKey } ,
830829 { "ruleKey" , ruleKey } ,
831- { "reasons" , decisionReasons } ,
830+ { "reasons" , reasonsToReport } ,
832831 { "decisionEventDispatched" , decisionEventDispatched }
833832 } ;
834833
@@ -842,7 +841,7 @@ internal OptimizelyDecision Decide(OptimizelyUserContext user,
842841 ruleKey ,
843842 key ,
844843 user ,
845- reasonsToReport . ToArray ( ) ) ;
844+ reasonsToReport ) ;
846845 }
847846
848847 internal Dictionary < string , OptimizelyDecision > DecideAll ( OptimizelyUserContext user ,
@@ -929,7 +928,7 @@ private void SendImpressionEvent(Experiment experiment, Variation variation, str
929928 /// <param name="userAttributes">The user's attributes</param>
930929 /// <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>
931930 /// <param name="ruleType">It can either be experiment in case impression event is sent from activate or it's feature-test or rollout</param>
932- private void SendImpressionEvent ( Experiment experiment , Variation variation , string userId ,
931+ private bool SendImpressionEvent ( Experiment experiment , Variation variation , string userId ,
933932 UserAttributes userAttributes , ProjectConfig config ,
934933 string flagKey , string ruleType , bool enabled )
935934 {
@@ -941,7 +940,7 @@ private void SendImpressionEvent(Experiment experiment, Variation variation, str
941940 var userEvent = UserEventFactory . CreateImpressionEvent ( config , experiment , variation , userId , userAttributes , flagKey , ruleType , enabled ) ;
942941 if ( userEvent == null )
943942 {
944- return ;
943+ return false ;
945944 }
946945 EventProcessor . Process ( userEvent ) ;
947946
@@ -958,6 +957,7 @@ private void SendImpressionEvent(Experiment experiment, Variation variation, str
958957 NotificationCenter . SendNotifications ( NotificationCenter . NotificationType . Activate , experiment , userId ,
959958 userAttributes , variation , impressionEvent ) ;
960959 }
960+ return true ;
961961 }
962962
963963 /// <summary>
0 commit comments