Skip to content

Commit

Permalink
Merge pull request #1638 from mohanachandran-s/develop
Browse files Browse the repository at this point in the history
MOSIP-35897 - Fixed automation failures
  • Loading branch information
mohanachandran-s authored Oct 8, 2024
2 parents 62e8a4c + 6aac0cd commit b876c2c
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4655,6 +4655,7 @@ private static ArrayList<JSONObject> convertJson(String[] templateFields, String
JSONObject langjson = new JSONObject(template);
for (String fieldToConvert : list) {
boolean isFilterRequired = false;
boolean isDataRequired = false;
String valueToConvert = null;
String translatedValue = null;
if (jsonObject.has(fieldToConvert)) {
Expand All @@ -4675,7 +4676,7 @@ private static ArrayList<JSONObject> convertJson(String[] templateFields, String
if (filtervalue.has(fieldToConvert)) {
valueToConvert = filtervalue.getString(fieldToConvert);
translatedValue = valueToConvert;
isFilterRequired = false;
isDataRequired = true;
}
}

Expand All @@ -4692,6 +4693,16 @@ private static ArrayList<JSONObject> convertJson(String[] templateFields, String
langjson.remove(GlobalConstants.FILTERS);
langjson.put(GlobalConstants.FILTERS, filtertransvalue);

} else if (isDataRequired) {
String dataValueToConvert = jsonObject.getJSONArray(GlobalConstants.KEYWORD_DATA).get(0).toString();
JSONObject dataValue = new JSONObject(dataValueToConvert);
String dataValue1 = dataValue.toString().replace(valueToConvert, translatedValue);
JSONObject translatedDataValue = new JSONObject(dataValue1);
JSONArray dataTransValue = new JSONArray();
dataTransValue.put(translatedDataValue);
langjson.remove(GlobalConstants.KEYWORD_DATA);
langjson.put(GlobalConstants.KEYWORD_DATA, dataTransValue);

} else if (!isFilterRequired && !langjson.isNull(fieldToConvert) || translatedValue != null)
langjson.put(fieldToConvert, translatedValue);
}
Expand Down

0 comments on commit b876c2c

Please sign in to comment.