rapidftr / tracker

The Issue Tracker for RapidFTR
2 stars 3 forks source link

Syncing enquiries on mobile fails if an existing enquiry on mobile is edited on the web #180

Closed tomclement closed 10 years ago

tomclement commented 10 years ago

When an enquiry that exists on the mobile is edited on the web and a sync operation attempted, the 'sync enquiries' operation fails

Steps to Reproduce

Expected Result The sync should be successful and viewing the edited enquiry on the mobile should display the updated information

Actual Result The sync operation fails

ctumwebaze commented 10 years ago

The primary cause of this issue was that the mobile application was sending back to the server certain system fields that are reserved for couchdb i.e. '_rev' which caused conflicts when one attempted to sync. For example when a change is made to an enquiry on the server, the '_rev' field is updated and if a change is then made on the mobile, when one attempts to sync, the '_rev' field is sent as part of the record to the server and the server will attempt to update this field which couchdb will not accept. So to fix this, we removed the system fields (_rev) from the data that is sent to the server.

As part of the fix, we also ensured that the latest changes take precedence i.e if the mobile device has the latest changes based on the last updated date, then it's changes will take precedence (this is consistent with the way children sync functionality works.)

This fix also handles merging histories of the enquiries from the mobile to those of the server in the event the changes were made on the mobile.

tomclement commented 10 years ago

Resolved with rapidftr/RapidFTR-Android#169