teamraincoat / agricat

Enrollment application for agricultural insurance policies
0 stars 0 forks source link

Modify synced back Enrollments #23

Closed j0x0j closed 2 years ago

j0x0j commented 2 years ago

@tushali024 I have implemented a cloud function and trigger to update _partition value for enrollments that have an Active status after sync. The goal here is for finished enrollments to sync once back to atlas and don't sync back down to other devices in same partition as well as removing the record from the device.

Now, what happens at the moment, after user syncs, is that the Enrollment is uploaded and cloud function triggers update on partition value, but the document isn't removed from the device locally. If the user closes the app and opens it again, a fresh sync process removes the local Enrollment as expected and the total number in campaign as well as the total number of locally enrolled is reduced correctly.

What I propose is that after user triggers sync in UploadDataModal we somehow wait some time and trigger the sync process before showing the home screen again. That way the user sees the correct number of enrollments left to finish.

tushali024 commented 2 years ago

done