Skip to content

Commit

Permalink
Handle empty repeated group header. (#2574)
Browse files Browse the repository at this point in the history
* empty repeated group header.

* Remove unnecessary filter

---------

Co-authored-by: Santosh Pingle <[email protected]>
Co-authored-by: Jing Tang <[email protected]>
  • Loading branch information
3 people committed Jun 18, 2024
1 parent 904b221 commit ae8c9bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,9 @@ internal class QuestionnaireViewModel(application: Application, state: SavedStat
}
// Retain the hierarchy and order of items within the questionnaire as specified in the
// standard. See https://www.hl7.org/fhir/questionnaireresponse.html#notes.
questionnaire.item.forEach {
if (it.type != Questionnaire.QuestionnaireItemType.GROUP || !it.repeats) {
questionnaireResponse.addItem(it.createQuestionnaireResponseItem())
}
}
questionnaire.item
.filterNot { it.isRepeatedGroup }
.forEach { questionnaireResponse.addItem(it.createQuestionnaireResponseItem()) }
}
}
questionnaireResponse.packRepeatedGroups(questionnaire)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,9 @@ fun Questionnaire.QuestionnaireItemComponent.createQuestionnaireResponseItem():
!repeats
) {
this@createQuestionnaireResponseItem.item.forEach {
this.addItem(it.createQuestionnaireResponseItem())
if (!it.isRepeatedGroup) {
this.addItem(it.createQuestionnaireResponseItem())
}
}
}
}
Expand Down

0 comments on commit ae8c9bb

Please sign in to comment.