Skip to content

Commit

Permalink
remove backward compatibility flag
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham1g5 authored and github-actions committed Sep 5, 2023
1 parent a8023f5 commit 52aeade
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions src/cli/java/org/commcare/util/screen/QueryScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,33 +181,10 @@ private String getInstanceKey(String instanceId, Map<String, String> values) {
return CryptUtil.sha256(builder.toString());
}

public void answerPrompts(Hashtable<String, String> answers, boolean selectValuesByKeys) {
public void answerPrompts(Hashtable<String, String> 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<SelectChoice> selectChoices = queryPrompt.getItemsetBinding().getChoices();
String[] indicesOfSelectedChoices = RemoteQuerySessionManager.extractMultipleChoices(answer);
ArrayList<String> 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();
Expand Down Expand Up @@ -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<String, String> requestData = getQueryParams(false);
InputStream response = sessionUtils.makeQueryRequest(url, requestData, domainedUsername, password);
Expand Down

0 comments on commit 52aeade

Please sign in to comment.