Scenario
I have the following components that make up an inspection styled application
It will start with a web user scheduling new inspections for a mobile user and save them to the database. The device user will log into the mobile app and refresh their schedule list so that the latest scheduled items will be returned and displayed to them. The web user can then create / update / or remove inspections at any time.
The Problem
Each time the device user refreshes their schedule list all of their schedule data will be returned and added to local storage. This means duplicates will be created because some of the data may have already been on the device.
The Resolution
To prevent duplicates occurring I will add an extra field to the database to flag the item as "received by app" so that flagged items can be ignored the next time the device user refreshes their schedule list, and to stop the web user from updating or removing them.
Loopholes with this Resolution
My Question
I would like to know if anybody has an efficient solution for managing this loophole or if I should be changing any steps in the scenario to begin with to stop this loophole appearing?
You may use Timestamps to check last time local storage was updated. And with every request to the database you may compare the local storage timestamp with database timestamp and fetch only those which are created after the timestamp.