From ef4d265339aa75b105b24bb7a7c9f0cab97fe0d9 Mon Sep 17 00:00:00 2001 From: Shubham Goyal Date: Fri, 1 Sep 2023 14:04:21 -0500 Subject: [PATCH] remove backward compatibility flag --- .../org/commcare/util/screen/QueryScreen.java | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/cli/java/org/commcare/util/screen/QueryScreen.java b/src/cli/java/org/commcare/util/screen/QueryScreen.java index 7eee1ee2e..ca18fcc85 100644 --- a/src/cli/java/org/commcare/util/screen/QueryScreen.java +++ b/src/cli/java/org/commcare/util/screen/QueryScreen.java @@ -181,33 +181,10 @@ private String getInstanceKey(String instanceId, Map values) { return CryptUtil.sha256(builder.toString()); } - public void answerPrompts(Hashtable answers, boolean selectValuesByKeys) { + public void answerPrompts(Hashtable answers) { for (Enumeration en = userInputDisplays.keys(); en.hasMoreElements(); ) { String key = (String)en.nextElement(); - QueryPrompt queryPrompt = userInputDisplays.get(key); String answer = answers.get(key); - - // If select question, we should have got an index as the answer which should - // be converted to the corresponding value - if (queryPrompt.isSelect() && !StringUtils.isEmpty(answer)) { - remoteQuerySessionManager.populateItemSetChoices(queryPrompt); - if (!selectValuesByKeys) { - Vector selectChoices = queryPrompt.getItemsetBinding().getChoices(); - String[] indicesOfSelectedChoices = RemoteQuerySessionManager.extractMultipleChoices(answer); - ArrayList selectedChoices = new ArrayList<>(indicesOfSelectedChoices.length); - for (int i = 0; i < indicesOfSelectedChoices.length; i++) { - if (indicesOfSelectedChoices[i].isEmpty()) { - selectedChoices.add(""); - } else { - int choiceIndex = Integer.parseInt(indicesOfSelectedChoices[i]); - if (choiceIndex < selectChoices.size() && choiceIndex > -1) { - selectedChoices.add(selectChoices.get(choiceIndex).getValue()); - } - } - } - answer = String.join(RemoteQuerySessionManager.ANSWER_DELIMITER, selectedChoices); - } - } remoteQuerySessionManager.answerUserPrompt(key, answer); } remoteQuerySessionManager.refreshInputDependentState(); @@ -265,7 +242,7 @@ public boolean handleInputAndUpdateSession(CommCareSession session, String input userAnswers.put(queryPromptEntry.getKey(), answers[count]); count++; } - answerPrompts(userAnswers, true); + answerPrompts(userAnswers); URL url = getBaseUrl(); Multimap requestData = getQueryParams(false); InputStream response = sessionUtils.makeQueryRequest(url, requestData, domainedUsername, password);