Skip to content

Commit 7710bc8

Browse files
committed
If translatable answer for select_one can't be determined - return the value
1 parent 869cf29 commit 7710bc8

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

collect_app/src/main/java/org/odk/collect/android/formhierarchy/QuestionAnswerProcessor.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ object QuestionAnswerProcessor {
2525
return ""
2626
}
2727

28-
if (!fep.answerText.isNullOrBlank() &&
28+
val answerText = try {
29+
fep.answerText
30+
} catch (e: Exception) {
31+
fep.answerValue?.displayText
32+
}
33+
if (!answerText.isNullOrBlank() &&
2934
Appearances.isMasked(fep) &&
3035
fep.controlType == Constants.CONTROL_INPUT &&
3136
fep.dataType == Constants.DATATYPE_TEXT
@@ -72,7 +77,7 @@ object QuestionAnswerProcessor {
7277

7378
if (data != null && appearance != null && appearance.contains(Appearances.THOUSANDS_SEP)) {
7479
return try {
75-
val answerAsDecimal = BigDecimal(fep.answerText)
80+
val answerAsDecimal = BigDecimal(answerText)
7681

7782
val df = DecimalFormat()
7883
df.groupingSize = 3
@@ -101,6 +106,6 @@ object QuestionAnswerProcessor {
101106
}
102107
return ItemsetDao(ItemsetDbAdapter()).getItemLabel(fep.answerValue!!.displayText, formController.getMediaFolder()!!.absolutePath, language)
103108
}
104-
return fep.answerText ?: ""
109+
return answerText ?: ""
105110
}
106111
}

0 commit comments

Comments
 (0)