-
Notifications
You must be signed in to change notification settings - Fork 23
Update observations from Xform submission response. #256
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
Conversation
Previously, when submitting an Xform, we parsed the XML in the request body to add a set of "temporary observations" to the database. These had the correct values, but didn't have UUIDs from the server. This mechanism was prone to the issues described in #125, so instead of using temporary observations, we retrieve the result of the Xform submission from the server, and insert real, server-provided observation information into the local data store instead. Fixes #125.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@capnfabs It's difficult to use the Generic error listener (the one with the toasts)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, don't need to do it right now though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it would be difficult, it was just like this when I got here :)
|
@capnfabs Looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Hey @viniciusboson! Yeah, I think they'll fix the same problems that you're dealing with, so long as all the forms have definitely finished submitting before sync starts. There might still be a "flicker" where an observation exists, and then disappears, and then comes back again if a sync occurs before the form is uploaded, however. So it's important to make sure that all forms are submitted before sync proceeds :) I realised overnight that your code still depends on a lot of the temporary observations logic that I deleted in this change, so I'll add that logic back in now, so it's not deleted when I merge this PR. |
Vinicius is using this for offline form submission, so we need to keep it for when his changes get merged.
Update observations from Xform submission response.
|
Hey @capnfabs, |
Previously, when submitting an Xform, we parsed the XML in the request body to add a set of
"temporary observations" to the database. These had the correct values, but didn't have UUIDs from
the server.
This mechanism was prone to the issues described in #125, so instead of using temporary
observations, we retrieve the result of the Xform submission from the server, and insert real,
server-provided observation information into the local data store instead.
Fixes #125.
Note: this change also includes some formatting fixes, I got sick of fighting the Android Studio auto-formatter.