-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improved handling invalid geo answers #5533
Conversation
0ca4e31
to
901818b
Compare
901818b
to
22a91c5
Compare
962c17d
to
7ce2d9a
Compare
380283b
to
3b050d4
Compare
3b050d4
to
a125b4f
Compare
I thought I'd be able to reproduce this by adding an invalid default to a geopoint question. So in <geopoint_widget>blah</geopoint_widget> That weirdly doesn't cause the issue though. If I set a valid default (like "51.5074 -0.1278") that does work though. I can't see anything that Collect does to clean that up. Can @lognaturel or @grzesiek2010 explain what's happening there? |
I've tried defaults and calculations to no avail. This is handled in javarosa. I don't know where exactly because I don't need it but it is. That's why I think invalid data can be only passed via the setData method, for example an external GPS device might be used that sometimes returns invalid data. |
Tested with Success! Verified on device with Android: 12, 13 Verified cases: |
Closes #5532
What has been done to verify that this works as intended?
I've added automated tests.
Why is this the best possible solution? Were any other approaches considered?
I wasn't able to reproduce the issue in real world (only hardcoding invalid answers or using tests). I believe the problem was in
setData()
methods where we didn't protect from injecting invalid answers. I've fixed those methods and also fixed reading answers when widgets are created.I think that after introducing those improvements this issue https://console.firebase.google.com/u/1/project/api-project-322300403941/crashlytics/app/android:org.odk.collect.android/issues/324b108b1880c264d9c3f01101110e03?time=last-seven-days&versions=v2023.1.0%20(4611)&types=crash&sessionEventKey=642570CE003900014975C8483B90F492_1794743691754173217 was also handled but just in case I've added improvements there too in the last commit.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
I wasn't able to reproduce the issue so we can focus on testing the GeoPoint and GeoPointMapWidget widgets for regression.
Do we need any specific form for testing your changes? If so, please attach one.
No.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.