Skip to content

Commit

Permalink
#1291 | During entity service updateObservations, use whole object to…
Browse files Browse the repository at this point in the history
… ensure all modifications are saved including profile-pic which is outside observations, but with Realm.UpdateMode.Modified flag, to only effect delta change on the realmDB
  • Loading branch information
himeshr committed Feb 9, 2024
1 parent e7c9d54 commit 8ae8fad
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/openchs-android/src/service/EncounterService.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class EncounterService extends BaseService {
ObservationsHolder.convertObsForSave(encounter.cancelObservations);
const db = this.db;
this.db.write(() => {
db.create(Encounter.schema.name, encounter, true);
db.create(Encounter.schema.name, encounter, Realm.UpdateMode.Modified);
db.create(EntityQueue.schema.name, EntityQueue.create(encounter, Encounter.schema.name));
});
}
Expand Down
5 changes: 1 addition & 4 deletions packages/openchs-android/src/service/IndividualService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}, Realm.UpdateMode.Modified);
db.create(Individual.schema.name, individual, Realm.UpdateMode.Modified);
db.create(EntityQueue.schema.name, EntityQueue.create(individual, Individual.schema.name));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ class ProgramEnrolmentService extends BaseService {
const db = this.db;
this.db.write(() => {
ProgramEnrolmentService.convertObsForSave(programEnrolment);
db.create(ProgramEnrolment.schema.name, {
uuid: programEnrolment.uuid,
observations: programEnrolment.observations
}, Realm.UpdateMode.Modified);
db.create(ProgramEnrolment.schema.name, programEnrolment, Realm.UpdateMode.Modified);
db.create(EntityQueue.schema.name, EntityQueue.create(programEnrolment, ProgramEnrolment.schema.name));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class ProgramEncounterService extends BaseService {
ObservationsHolder.convertObsForSave(programEncounter.cancelObservations);
const db = this.db;
this.db.write(() => {
db.create(ProgramEncounter.schema.name, programEncounter, true);
db.create(ProgramEncounter.schema.name, programEncounter, Realm.UpdateMode.Modified);
db.create(EntityQueue.schema.name, EntityQueue.create(programEncounter, ProgramEncounter.schema.name));
});
}
Expand Down

0 comments on commit 8ae8fad

Please sign in to comment.