Skip to content

Fixed to prevent checkbox crashes#2661 #2800

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion catalog/src/main/assets/component_multi_select_choice.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"linkId": "1.0.0",
"text": "What’s the reason for today’s visit?",
"type": "choice",
"repeats": true,
"repeats": false,
Copy link
Collaborator

@FikriMilano FikriMilano Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be true, because this json example is intended to showcase checkbox widget

Copy link
Collaborator

@MJ1998 MJ1998 Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmanojkmr this is also true.
with repeats set to false, we are not checking multi-choice anymore.
repeats needs to be true.
Given that, you probably need to add the check-box extension (if not already there) like the json in the issue this PR is solving to confirm that SDC is not crashing.

"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ internal object CheckBoxGroupViewHolderFactory :
val newAnswers = questionnaireViewItem.answers.toMutableList()
newAnswers +=
QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent().apply {
if(!questionnaireViewItem.questionnaireItem.repeats){
newAnswers.clear()
}
value = answerOption.value
}

Expand Down
Loading