Skip to content

Commit 0e827fc

Browse files
committed
improve readability
1 parent c4d35e2 commit 0e827fc

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/java/com/flagsmith/flagengine/segments/SegmentEvaluator.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,15 @@ private static Boolean contextMatchesCondition(
110110
return conditionList.contains(contextValue);
111111

112112
case PERCENTAGE_SPLIT:
113-
String key = (contextValue != null) ? contextValue.toString()
114-
: (context.getIdentity() != null) ? context.getIdentity().getKey() : null;
115-
116-
if (key == null) {
117-
return false;
113+
String key;
114+
if (contextValue == null) {
115+
if (context.getIdentity() == null) {
116+
return false;
117+
}
118+
key = context.getIdentity().getKey();
119+
} else {
120+
key = contextValue.toString();
118121
}
119-
120122
List<String> objectIds = List.of(segmentKey, key);
121123

122124
final float floatValue;

0 commit comments

Comments
 (0)