From 3fc1be3f25238fd2e5ad4189b26941b5cbdfa449 Mon Sep 17 00:00:00 2001 From: himeshr Date: Mon, 12 Feb 2024 14:21:05 +0530 Subject: [PATCH] #1295 | bug fix for old error to get loadedSince before filtering out IgnorableSyncErrors --- packages/openchs-android/src/service/SyncService.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/openchs-android/src/service/SyncService.js b/packages/openchs-android/src/service/SyncService.js index 0874ad8b0..0af8c61fa 100644 --- a/packages/openchs-android/src/service/SyncService.js +++ b/packages/openchs-android/src/service/SyncService.js @@ -309,6 +309,7 @@ class SyncService extends BaseService { persistAll(entityMetaData, entityResources) { if (_.isEmpty(entityResources)) return; entityResources = _.sortBy(entityResources, 'lastModifiedDateTime'); + const loadedSince = _.last(entityResources).lastModifiedDateTime; const entities = entityResources.reduce(transformResourceToEntity.call(this, entityMetaData, entityResources), []); const initialLength = entityResources.length; @@ -350,7 +351,7 @@ class SyncService extends BaseService { entitySyncStatus.entityName = entityMetaData.entityName; entitySyncStatus.entityTypeUuid = entityMetaData.syncStatus.entityTypeUuid; entitySyncStatus.uuid = currentEntitySyncStatus.uuid; - entitySyncStatus.loadedSince = new Date(_.last(entityResources).lastModifiedDateTime); + entitySyncStatus.loadedSince = new Date(loadedSince); General.logDebug("SyncService", `Creating entity create functions for ${currentEntitySyncStatus}`); this.bulkSaveOrUpdate(entitiesToCreateFns.concat(this.getCreateEntityFunctions(EntitySyncStatus.schema.name, [entitySyncStatus]))); this.dispatchAction(SyncTelemetryActions.ENTITY_PULL_COMPLETED, {