Skip to content

Commit

Permalink
#1295 | bug fix for old error to get loadedSince before filtering out…
Browse files Browse the repository at this point in the history
… IgnorableSyncErrors
  • Loading branch information
himeshr committed Feb 12, 2024
1 parent 8e09ca2 commit 3fc1be3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/openchs-android/src/service/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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, {
Expand Down

0 comments on commit 3fc1be3

Please sign in to comment.