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
datacapture : Bug in binding UI element to Questionnaire Item #132
Comments
Thanks Kashyap for creating this issue. Can you please push a branch with your code? I think there's a real problem with the use of activityViewModels in QuestionnaireFragment.kt. I tested that passing different questionnaires to different questionnaire fragments will reuse the same view model which is definitely incorrect. We need to somehow change the scope of view models to fragment... |
@jingtang10 Please check this branch https://github.com/google/android-fhir/tree/kj/sdc-binding-bug |
@kashyapj2793, I created PR #134 and tested with your change which I think is working. To verify that on your end, please rebase your branch onto the jt/sdc-set-values branch. The problem you encountered is very interesting. It's because recycler view reuses (and it's great to see that in action because it improves performance) the questionnaire item views. So if you have ticked a checkbox and scroll it outside of the viewport, recycler view might reuse that checkbox to render another question if that question is to be scrolled into the viewport. Because we had not implemented loading the answers properly from the view model, so when the recycling (of views) happened, the adapter didn't set the state of the checkbox correctly. So what you ended up with was a checkbox that had been ticked for a question being reused for another question without being cleared. |
I have verified that PR #134 fixes this issue |
Thanks Kashyap -- let's keep this open until that PR is merged into master. |
I have reset the tip of this branch to the first commit without the fix from the jt/sdc-set-values branch. This is so that until the PR is merged to master, the issue can be reproduced using this branch. |
Sorry I didn't mean to close this. Kashyap -- can you please verify this is indeed fixed for you (rebasing your branch onto master). |
No problem jing! Yes I have verified that this is fixed! |
datacapture_bug_UI_binding.mp4
Sample questionnaire modified by duplicating items. linkid of each item is unique
The text was updated successfully, but these errors were encountered: