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

datacapture : Bug in binding UI element to Questionnaire Item #132

Closed
joiskash opened this issue Dec 28, 2020 · 8 comments · Fixed by #133 or #134
Closed

datacapture : Bug in binding UI element to Questionnaire Item #132

joiskash opened this issue Dec 28, 2020 · 8 comments · Fixed by #133 or #134
Assignees
Labels
type:bug Something isn't working

Comments

@joiskash
Copy link
Collaborator

datacapture_bug_UI_binding.mp4

Sample questionnaire modified by duplicating items. linkid of each item is unique

@jingtang10
Copy link
Collaborator

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...

@joiskash
Copy link
Collaborator Author

@jingtang10
Copy link
Collaborator

jingtang10 commented Dec 28, 2020

@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.

@joiskash
Copy link
Collaborator Author

I have verified that PR #134 fixes this issue

@jingtang10
Copy link
Collaborator

Thanks Kashyap -- let's keep this open until that PR is merged into master.

@jingtang10 jingtang10 reopened this Dec 29, 2020
@joiskash
Copy link
Collaborator Author

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.

@jingtang10
Copy link
Collaborator

Sorry I didn't mean to close this.

Kashyap -- can you please verify this is indeed fixed for you (rebasing your branch onto master).

@jingtang10 jingtang10 reopened this Jan 7, 2021
@joiskash
Copy link
Collaborator Author

joiskash commented Jan 8, 2021

No problem jing! Yes I have verified that this is fixed!

@joiskash joiskash closed this as completed Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
Archived in project
2 participants