Update observations from Xform submission response.#256
Update observations from Xform submission response.#256capnfabs merged 2 commits intoprojectbuendia:devfrom capnfabs:fix/125
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.
@capnfabs It's difficult to use the Generic error listener (the one with the toasts)?
There was a problem hiding this comment.
Well, don't need to do it right now though.
There was a problem hiding this comment.
I don't think it would be difficult, it was just like this when I got here :)
|
@capnfabs Looks good. |
|
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.