Skip to content

Commit

Permalink
Merge pull request #949 from TIP-Global-Health/issue-948
Browse files Browse the repository at this point in the history
[Bug fix] Generate geo info data on first step of sync
  • Loading branch information
anvmn authored Nov 22, 2023
2 parents 2f80733 + 404e0e9 commit 55ce3c6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion client/src/elm/SyncManager/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,9 @@ update currentDate currentTime activePage dbVersion device msg model =

modelWithSyncStatus =
let
-- At general sync we get site param,
-- Theoretically, it may change, and therefore,
-- we recalculate geo info data.
geoInfo =
getGeoInfo syncInfoGeneral.site
in
Expand Down Expand Up @@ -1064,14 +1067,25 @@ update currentDate currentTime activePage dbVersion device msg model =
noChange

else
let
-- This is first step of sync.
-- When device is offline, we may not get any further,
-- therefore, we need to generate and store geo info data here.
geoInfo =
getGeoInfo model.syncInfoGeneral.site
in
update
currentDate
currentTime
activePage
dbVersion
device
(QueryIndexDb IndexDbQueryUploadPhoto)
{ model | syncStatus = SyncUploadPhoto errorsCount RemoteData.Loading }
{ model
| syncStatus = SyncUploadPhoto errorsCount RemoteData.Loading
, geoInfo = geoInfo
, reverseGeoInfo = getReverseGeoInfo geoInfo
}

_ ->
noChange
Expand Down

0 comments on commit 55ce3c6

Please sign in to comment.