Skip to content

Commit

Permalink
Merge branch '6.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
petmongrels committed Dec 22, 2023
2 parents e4856e9 + d85a867 commit e27cd38
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/openchs-android/src/service/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function transformResourceToEntity(entityMetaData, entityResources) {
return acc.concat([entityMetaData.entityClass.fromResource(resource, this.entityService, entityResources)]);
} catch (error) {
if(error instanceof IgnorableSyncError) {
resource.excludeFromPersist = true;
General.logError("SyncService", error);
} else {
throw error;
Expand Down Expand Up @@ -310,6 +311,10 @@ class SyncService extends BaseService {
entityResources = _.sortBy(entityResources, 'lastModifiedDateTime');

const entities = entityResources.reduce(transformResourceToEntity.call(this, entityMetaData, entityResources), []);
const initialLength = entityResources.length;
//Filtering out the entityResources which were not converted into entities due to IgnorableSyncErrors
entityResources = _.filter(entityResources, (resource) => !resource.excludeFromPersist);
General.logDebug("SyncService", `Before filter entityResources length: ${initialLength}, after filter entityResources length: ${entityResources.length}, entities length ${entities.length}`);
General.logDebug("SyncService", `Creating entity create functions for schema ${entityMetaData.schemaName}`);
let entitiesToCreateFns = this.getCreateEntityFunctions(entityMetaData.schemaName, entities);
if (entityMetaData.nameTranslated) {
Expand Down

0 comments on commit e27cd38

Please sign in to comment.