android-fhir icon indicating copy to clipboard operation
android-fhir copied to clipboard

Demo app - last sync time updates even when sync fails

Open williamito opened this issue 2 years ago • 4 comments

Describe the bug The app is in a state where sync appears to fail 100% of the time. The "Last sync" timestamp in the menu updates after failure.

Component Demo app

To Reproduce Steps to reproduce the behavior:

  1. Make sync fail. I did this by creating a patient on the server, syncing to the app, deleting the patient from the server, and editing the same patient on the app.
  2. Open menu and select Sync

Expected behavior "Last sync" usually means "last successfully synced", so I do not expect the timestamp to update on failure.

Screenshots If applicable, add screenshots to help explain your problem.

https://user-images.githubusercontent.com/7772901/193365131-a316ef68-cd07-4d4a-9122-564bc72e8273.mp4

Smartphone (please complete the following information):

  • Device: Pixel 4

williamito avatar Sep 30 '22 22:09 williamito

FhirSynchronizer

private suspend fun setSyncState(result: Result): Result {

datastoreUtil.writeLastSyncTimestamp(result.timestamp)

when (result) {
  is Result.Success -> setSyncState(State.Finished(result))
  is Result.Error -> setSyncState(State.Failed(result))
}

return result

}

rajeshvelicheti avatar Oct 14 '22 17:10 rajeshvelicheti

@jingtang10, any thoughts if this change should be included in the backlog?

Tarun-Bhardwaj avatar Oct 18 '22 07:10 Tarun-Bhardwaj

@MJ1998 can you take a look at this?

jingtang10 avatar Jan 30 '24 12:01 jingtang10

@williamito

The last sync timestamp reflects the most recent sync attempt, even if unsuccessful.
I think it should be updated because its possible that the sync was partially successful. Maybe we should include a sync status in the menu, like Successful or Failed ?

MJ1998 avatar Feb 06 '24 13:02 MJ1998