Skip to content
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

populate initial with initialExpression result collection #2751

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

parthfloyd
Copy link
Collaborator

@parthfloyd parthfloyd commented Dec 6, 2024

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #2750

Description
Updated populateInitialValue() function in ResourceMapper.kt of the SDC module to populate questionnaireItem.initial with values of collection instead of just the first value of the collection.

Alternative(s) considered
None | Looking forward to feedback

Type
Bug fix

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

@parthfloyd parthfloyd requested a review from a team as a code owner December 6, 2024 06:31
@parthfloyd parthfloyd requested a review from jingtang10 December 6, 2024 06:31
@LZRS
Copy link
Collaborator

LZRS commented Dec 6, 2024

To support multiple initially selected options from the dropdown, not quite sure populating the Questionnaire.item.initial would work.
From this Questionnaire.item.initial invariant

que-11 Rule If one or more answerOption is present, initial cannot be present. Use answerOption.initialSelected instead answerOption.empty() or initial.empty()

I would suggest maybe using Questionnaire.item.answerOption.initialSelected instead

@parthfloyd
Copy link
Collaborator Author

@LZRS Thank you so much for your feedback!
I've pushed code & now it's conforming with the invariant rules. Please feel free if any changes or optimizations are required in the code.

Invariant:

que-8 Rule Initial values can't be specified for groups or display items

que-13 Rule Can only have multiple initial values for repeating items

que-11 Rule If one or more answerOption is present, initial cannot be present. Use answerOption.initialSelected instead

cc: @jingtang10 , @icrc-jofrancisco

Copy link
Collaborator

@LZRS LZRS left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SDC library] initialExpression with multiple values as result rendering incorrectly.
2 participants