From e67f477b1fd02af03442bc7e709f8e6b62f5d2c1 Mon Sep 17 00:00:00 2001 From: Joy A Date: Wed, 7 Feb 2024 16:13:05 +0530 Subject: [PATCH 1/3] #1289 | Bump models --- packages/openchs-android/package-lock.json | 14 +++++++------- packages/openchs-android/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/openchs-android/package-lock.json b/packages/openchs-android/package-lock.json index 32403e757..eecdcd0da 100644 --- a/packages/openchs-android/package-lock.json +++ b/packages/openchs-android/package-lock.json @@ -34,7 +34,7 @@ "lodash": "4.17.21", "moment": "2.29.4", "native-base": "3.4.9", - "openchs-models": "1.31.26", + "openchs-models": "1.31.30", "prop-types": "15.8.1", "react": "18.2.0", "react-native": "0.72.3", @@ -16439,9 +16439,9 @@ } }, "node_modules/openchs-models": { - "version": "1.31.26", - "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.31.26.tgz", - "integrity": "sha512-/kEq646aut4gqxCEs3hw3e6ZNIS6gVVCEfmFgl2cHQPCFzwr+ySY2n1MABALbDVBuxl66C3iRBZY76UXDAMLGg==", + "version": "1.31.30", + "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.31.30.tgz", + "integrity": "sha512-DTZBPjmF69NUbZasgk9orbMEDZn1p419NnX4jy2qlMxbSeL+BBtzTJ9UTmrEgRUG+koSXWk+KrtymijW/13wsQ==", "dependencies": { "uuid": "^9.0.1" }, @@ -35170,9 +35170,9 @@ } }, "openchs-models": { - "version": "1.31.26", - "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.31.26.tgz", - "integrity": "sha512-/kEq646aut4gqxCEs3hw3e6ZNIS6gVVCEfmFgl2cHQPCFzwr+ySY2n1MABALbDVBuxl66C3iRBZY76UXDAMLGg==", + "version": "1.31.30", + "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.31.30.tgz", + "integrity": "sha512-DTZBPjmF69NUbZasgk9orbMEDZn1p419NnX4jy2qlMxbSeL+BBtzTJ9UTmrEgRUG+koSXWk+KrtymijW/13wsQ==", "requires": { "uuid": "^9.0.1" } diff --git a/packages/openchs-android/package.json b/packages/openchs-android/package.json index 1b9807335..80e30731e 100644 --- a/packages/openchs-android/package.json +++ b/packages/openchs-android/package.json @@ -58,7 +58,7 @@ "lodash": "4.17.21", "moment": "2.29.4", "native-base": "3.4.9", - "openchs-models": "1.31.29", + "openchs-models": "1.31.30", "prop-types": "15.8.1", "react": "18.2.0", "react-native": "0.72.3", From 17715d7bb3f823d42fb7509366418d74f408585b Mon Sep 17 00:00:00 2001 From: himeshr Date: Thu, 8 Feb 2024 12:15:29 +0530 Subject: [PATCH 2/3] #1290 | Fix merge over-written change and save individual as is --- packages/openchs-android/src/service/IndividualService.js | 5 +---- packages/openchs-android/src/service/MediaQueueService.js | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/openchs-android/src/service/IndividualService.js b/packages/openchs-android/src/service/IndividualService.js index 6fb09217d..147f97db7 100644 --- a/packages/openchs-android/src/service/IndividualService.js +++ b/packages/openchs-android/src/service/IndividualService.js @@ -109,10 +109,7 @@ class IndividualService extends BaseService { const db = this.db; this.db.write(() => { ObservationsHolder.convertObsForSave(individual.observations); - db.create(Individual.schema.name, { - uuid: individual.uuid, - observations: individual.observations - }, true); + db.create(Individual.schema.name, individual, true); db.create(EntityQueue.schema.name, EntityQueue.create(individual, Individual.schema.name)); }); } diff --git a/packages/openchs-android/src/service/MediaQueueService.js b/packages/openchs-android/src/service/MediaQueueService.js index 743aa0d7a..ea3b7c05c 100644 --- a/packages/openchs-android/src/service/MediaQueueService.js +++ b/packages/openchs-android/src/service/MediaQueueService.js @@ -201,6 +201,7 @@ class MediaQueueService extends BaseService { }) .then(() => this.uploadToUrl(uploadUrl, mediaQueueItem)) .then(() => this.replaceObservation(mediaQueueItem, uploadUrl)) + .then(() => this.popItem(mediaQueueItem)) .catch((error) => { General.logError("MediaQueueService", `Error while uploading ${mediaQueueItem.uuid} - ${mediaQueueItem.fileName}`); General.logError("MediaQueueService", error); From f955285364ba8e7d0d1242427f7034b3b8abc045 Mon Sep 17 00:00:00 2001 From: himeshr Date: Thu, 8 Feb 2024 14:07:57 +0530 Subject: [PATCH 3/3] #1290 | Save individual and programEnrolment observations only in Realm.UpdateMode.Modified mode --- packages/openchs-android/src/service/IndividualService.js | 5 ++++- .../openchs-android/src/service/ProgramEnrolmentService.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/openchs-android/src/service/IndividualService.js b/packages/openchs-android/src/service/IndividualService.js index 147f97db7..9407cf329 100644 --- a/packages/openchs-android/src/service/IndividualService.js +++ b/packages/openchs-android/src/service/IndividualService.js @@ -109,7 +109,10 @@ class IndividualService extends BaseService { const db = this.db; this.db.write(() => { ObservationsHolder.convertObsForSave(individual.observations); - db.create(Individual.schema.name, individual, true); + db.create(Individual.schema.name, { + uuid: individual.uuid, + observations: individual.observations + }, Realm.UpdateMode.Modified); db.create(EntityQueue.schema.name, EntityQueue.create(individual, Individual.schema.name)); }); } diff --git a/packages/openchs-android/src/service/ProgramEnrolmentService.js b/packages/openchs-android/src/service/ProgramEnrolmentService.js index c50dec0bb..a9af59c26 100644 --- a/packages/openchs-android/src/service/ProgramEnrolmentService.js +++ b/packages/openchs-android/src/service/ProgramEnrolmentService.js @@ -67,7 +67,7 @@ class ProgramEnrolmentService extends BaseService { db.create(ProgramEnrolment.schema.name, { uuid: programEnrolment.uuid, observations: programEnrolment.observations - }, true); + }, Realm.UpdateMode.Modified); db.create(EntityQueue.schema.name, EntityQueue.create(programEnrolment, ProgramEnrolment.schema.name)); }); }