-
Type:
Task
-
Resolution: Unresolved
-
Priority:
High
-
Affects Version/s: None
-
None
Currently, beneficiary data is pulled using page-based pagination. During tab-to-tab sync, if a new beneficiary is registered or an existing beneficiary is updated from another tab, record positions can shift between pages. This can result in missed data when a device continues sync from a later page.
As a short-term fix, manual refresh and auto-pull start from page 0. This is suitable for camps with up to approximately 500 beneficiaries. For larger datasets, pulling all beneficiary data during every sync can increase sync time, network usage, and server load.
This task will implement timestamp/cursor-based incremental beneficiary sync.
Proposed Solution:
- On first sync, the app will perform a full beneficiary pull using fromDate = null/default.
- Backend will return a fixed syncTimestamp or cursor for the sync.
- The app will store the returned timestamp only after all pages are successfully downloaded and saved.
- On subsequent syncs, the app will send the saved timestamp to the backend.
- Backend will return only beneficiaries created or updated after the provided timestamp.
- If a sync fails midway, the timestamp will not be updated, so no records are missed in the next sync.
- Backend should return records in a stable order for pagination.
Acceptance Criteria:
- First sync downloads all beneficiary records for the selected village.
- Subsequent sync downloads only new or updated records.
- A new beneficiary or update from another tab is available after the next sync.
- Failed or partial sync does not cause data loss or missed records.
- Full data pull is avoided on routine sync for large datasets.
- Solution works reliably for camps with more than 500 beneficiaries.