Skip to content

Commit fe63b45

Browse files
committed
feat: removed-targeting-reason-func
1 parent 12144a3 commit fe63b45

File tree

1 file changed

+2
-15
lines changed
  • lib/flagsmith/engine/evaluation

1 file changed

+2
-15
lines changed

lib/flagsmith/engine/evaluation/core.rb

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ def evaluate_features(evaluation_context, segment_overrides)
9494

9595
# Set reason
9696
flag_result[:reason] = evaluated[:reason] ||
97-
get_targeting_match_reason({ type: 'SEGMENT', override: segment_override })
98-
97+
(has_override ? "#{TARGETING_REASON_TARGETING_MATCH}; segment=#{segment_override[:segment_name]}" : TARGETING_REASON_DEFAULT)
9998
flags[final_feature[:name].to_sym] = flag_result
10099
end
101100

@@ -120,7 +119,7 @@ def get_multivariate_feature_value(feature, identity_key)
120119
if start_percentage <= percentage_value && percentage_value < limit
121120
return {
122121
value: variant[:value],
123-
reason: get_targeting_match_reason({ type: 'SPLIT', weight: variant[:weight] })
122+
reason: "#{TARGETING_REASON_SPLIT}; weight=#{variant[:weight]}"
124123
}
125124
end
126125
start_percentage = limit
@@ -152,18 +151,6 @@ def get_identity_key(evaluation_context)
152151
def is_stronger_priority?(priority_a, priority_b)
153152
(priority_a || WEAKEST_PRIORITY) < (priority_b || WEAKEST_PRIORITY)
154153
end
155-
156-
def get_targeting_match_reason(match_object)
157-
type = match_object[:type]
158-
159-
if type == 'SEGMENT'
160-
return match_object[:override] ? "#{TARGETING_REASON_TARGETING_MATCH}; segment=#{match_object[:override][:segment_name]}" : TARGETING_REASON_DEFAULT
161-
end
162-
163-
return "#{TARGETING_REASON_SPLIT}; weight=#{match_object[:weight]}" if type == 'SPLIT'
164-
165-
TARGETING_REASON_DEFAULT
166-
end
167154
end
168155
end
169156
end

0 commit comments

Comments
 (0)