From 162a3bf95809e10255e38ee084d19b3203de075e Mon Sep 17 00:00:00 2001 From: Shubham Goyal Date: Thu, 2 May 2024 16:17:40 +0530 Subject: [PATCH] fix query step extras to not have a list of list --- .../java/org/commcare/suite/model/StackFrameStep.java | 2 +- .../backend/suite/model/test/StackFrameStepTests.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/commcare/suite/model/StackFrameStep.java b/src/main/java/org/commcare/suite/model/StackFrameStep.java index dd36adde1..9ef331801 100644 --- a/src/main/java/org/commcare/suite/model/StackFrameStep.java +++ b/src/main/java/org/commcare/suite/model/StackFrameStep.java @@ -220,7 +220,7 @@ public StackFrameStep defineStep(EvaluationContext ec, SessionDatum neededDatum) StackFrameStep defined = new StackFrameStep(elementType, id, evaluateValue(ec)); extras.forEach((key, value) -> { if (value instanceof QueryData) { - defined.addExtra(key, ((QueryData)value).getValues(ec)); + defined.getExtras().putAll(key, ((QueryData)value).getValues(ec)); } else if (value instanceof XPathExpression) { // only to maintain backward compatibility with old serialised app db state, can be removed in // subsequent deploys diff --git a/src/test/java/org/commcare/backend/suite/model/test/StackFrameStepTests.java b/src/test/java/org/commcare/backend/suite/model/test/StackFrameStepTests.java index 33ccd7471..92f9b7518 100644 --- a/src/test/java/org/commcare/backend/suite/model/test/StackFrameStepTests.java +++ b/src/test/java/org/commcare/backend/suite/model/test/StackFrameStepTests.java @@ -181,11 +181,10 @@ public void stackWithQueries() throws Exception { StackFrameStep queryFrame = steps.get(2); assertEquals(SessionFrame.STATE_QUERY_REQUEST, queryFrame.getElementType()); - ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); - builder.put("case_type", ImmutableList.of("patient")); - builder.put("x_commcare_data_registry", ImmutableList.of("test")); - builder.put("case_id", ImmutableList.of("case_one")); - builder.put("case_id", ImmutableList.of("dupe1")); + ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); + builder.put("case_type", "patient"); + builder.put("x_commcare_data_registry", "test"); + builder.putAll("case_id", ImmutableList.of("case_one", "dupe1")); assertEquals(builder.build(), queryFrame.getExtras()); } }