Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
[sc-149512] Android reason fixes (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwhelanLD authored Apr 14, 2022
1 parent 285aa05 commit 067354d
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,30 @@ private ObjectBuilder objectBuilderFromDetail(EvaluationDetail<?> detail) {
ObjectBuilder resultMap = LDValue.buildObject();
if (!detail.isDefaultValue()) {
resultMap.put("variationIndex", detail.getVariationIndex());
} else {
resultMap.put("variationIndex", LDValue.ofNull());
}
EvaluationReason reason = detail.getReason();
if (reason == null) {
resultMap.put("reason", LDValue.ofNull());
return resultMap;
}
ObjectBuilder reasonMap = LDValue.buildObject();
reasonMap.put("kind", reason.getKind().name());
switch (reason.getKind()) {
case RULE_MATCH:
reasonMap.put("ruleIndex", reason.getRuleIndex());
if (reason.getRuleId() != null) {
reasonMap.put("ruleId", reason.getRuleId());
reasonMap.put("ruleId", reason.getRuleId());
if (reason.isInExperiment()) {
reasonMap.put("inExperiment", true);
}
break;
case PREREQUISITE_FAILED: reasonMap.put("prerequisiteKey", reason.getPrerequisiteKey()); break;
case ERROR: reasonMap.put("errorKind", reason.getErrorKind().name()); break;
case FALLTHROUGH:
if (reason.isInExperiment()) {
reasonMap.put("inExperiment", true);
}
default: break;
}
resultMap.put("reason", reasonMap.build());
Expand Down

0 comments on commit 067354d

Please sign in to comment.