Synchronize offline events when user is online
Description
Checklists
Activity

Alicja Baranowska March 22, 2021 at 8:56 AM
Tested with success
Verified cases:
When the user is online, their offline pending events are sent to the server
The events are sent in the same order they were created in the offline mode
The synchronization is happening in the background
The events are sent for proper user
The stock on hands table is updated after synchronization
After code refactoring, synchronization works fine and stock events are removed from Local Storage when they are sent properly
When I close the app during synchronization the events are sent
Verified on:
Ubuntu 20.04
Google Chrome Browser Version 85.0.4183.83
Firefox Version 80.0

Alicja Baranowska March 19, 2021 at 7:16 AM
Tested
Verified cases:
When the user is online, their offline pending events are sent to the server
The events are sent in the same order they were created in the offline mode
The synchronization is happening in the background
The events are sent for proper user
The stock on hands table is updated after synchronization
Verified on:
Ubuntu 20.04
Google Chrome Browser Version 85.0.4183.83
Firefox Version 80.0
one small issue, when I close the app during synchronization and I do it too fast the event is sent but still exists in the offline pending events table and in the header.
As soon as the connection to the OpenLMIS server is re-established, the application should attempt to synchronize the offline events it has with the server. The stock events should be sent synchronously in the same order they were created offline.
Questions:
Do we synchronize events for all users or just the user who is logged in?
We should synchronize just for the user who is logged in
Acceptance criteria:
When the user is online, their offline pending events are sent to the server
The events are sent in the same order they were created in the offline mode
The synchronization is happening in the background - the user can interact with the site
Sent events are considered successful unless the server responds with an error