-
Notifications
You must be signed in to change notification settings - Fork 310
Master mk 2790 #2805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Master mk 2790 #2805
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||||||||||||||
/* | ||||||||||||||||||
* Copyright 2023-2024 Google LLC | ||||||||||||||||||
* Copyright 2023-2025 Google LLC | ||||||||||||||||||
* | ||||||||||||||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||
* you may not use this file except in compliance with the License. | ||||||||||||||||||
|
@@ -195,7 +195,11 @@ data class QuestionnaireViewItem( | |||||||||||||||||
* if question is answered else 'Not Answered' | ||||||||||||||||||
*/ | ||||||||||||||||||
fun answerString(context: Context): String { | ||||||||||||||||||
if (!questionnaireResponseItem.hasAnswer()) return context.getString(R.string.not_answered) | ||||||||||||||||||
if (!questionnaireResponseItem.hasAnswer()) { | ||||||||||||||||||
return context.getString(R.string.not_answered) | ||||||||||||||||||
} else if (questionnaireItem.type == Questionnaire.QuestionnaireItemType.ATTACHMENT) { | ||||||||||||||||||
return context.getString(R.string.answered) | ||||||||||||||||||
} | ||||||||||||||||||
Comment on lines
+200
to
+202
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
return questionnaireResponseItem.answer.joinToString { it.value.displayString(context) } | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||
/* | ||||||
* Copyright 2022-2024 Google LLC | ||||||
* Copyright 2022-2025 Google LLC | ||||||
* | ||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
* you may not use this file except in compliance with the License. | ||||||
|
@@ -1003,4 +1003,20 @@ class QuestionnaireViewItemTest { | |||||
) | ||||||
.isTrue() | ||||||
} | ||||||
|
||||||
@Test | ||||||
fun `answerString() should return answered with answered`() { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
val questionnaireViewItem = | ||||||
QuestionnaireViewItem( | ||||||
Questionnaire.QuestionnaireItemComponent(), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you need to set the type to attachment |
||||||
QuestionnaireResponse.QuestionnaireResponseItemComponent() | ||||||
.addAnswer( | ||||||
QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent() | ||||||
.setValue(StringType("Attachment")), | ||||||
), | ||||||
validationResult = Valid, | ||||||
answersChangedCallback = { _, _, _, _ -> }, | ||||||
) | ||||||
assertThat(questionnaireViewItem.answerString(context)).isEqualTo("Attachment") | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change this back - this is the attachment widget, and we're not trying to show the review page when the user opens the attachment widget.
but we can add the attachment widget to the review page questionnaire, and i think that's reasonable.