openchs-models 1.31.73 → 1.31.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,8 +41,7 @@ _defineProperty(CustomFilter, "type", {
41
41
  EncounterDate: "EncounterDate",
42
42
  Address: "Address",
43
43
  Concept: "Concept",
44
- GroupSubject: "GroupSubject",
45
- SubjectType: "SubjectType"
44
+ GroupSubject: "GroupSubject"
46
45
  });
47
46
 
48
47
  _defineProperty(CustomFilter, "scope", {
@@ -84,8 +84,10 @@ class Observation extends _PersistedObject.default {
84
84
  return new _Displayable.default(valueWrapper.asDisplayTime(), null);
85
85
  } else if (valueWrapper.isSingleCoded) {
86
86
  if (observation.concept.datatype === _Concept.default.dataType.Subject) {
87
- const subject = subjectService.findByUUID(valueWrapper.getValue());
88
- return [new _Displayable.default(subject.nameStringWithUniqueAttribute, subject)];
87
+ const uuid = valueWrapper.getValue();
88
+ const subject = subjectService.findByUUID(uuid);
89
+ const displayName = subject && subject.nameStringWithUniqueAttribute || uuid;
90
+ return [new _Displayable.default(displayName, subject)];
89
91
  } else if (observation.concept.datatype === _Concept.default.dataType.Encounter) {
90
92
  const encounter = encounterService.findByUUID(valueWrapper.getValue());
91
93
  const identifier = observation.concept.recordValueByKey(_Concept.default.keys.encounterIdentifier);
@@ -59,7 +59,7 @@ class ObservationsHolder {
59
59
  const groupObservations = observations && observations.getValueWrapper();
60
60
 
61
61
  if (parentFormElement.repeatable) {
62
- return groupObservations && groupObservations.getGroupObservationAtIndex(questionGroupIndex).getObservation(concept);
62
+ return groupObservations && groupObservations.size() > questionGroupIndex && groupObservations.getGroupObservationAtIndex(questionGroupIndex).getObservation(concept);
63
63
  }
64
64
 
65
65
  return groupObservations && groupObservations.getObservation(concept);
@@ -132,14 +132,6 @@ class ReportCard extends _BaseEntity.default {
132
132
  return _lodash.default.isNil(this.standardReportCardType) ? false : this.standardReportCardType.isTaskType();
133
133
  }
134
134
 
135
- isStandardReportType() {
136
- return !_lodash.default.isNil(this.standardReportCardType);
137
- }
138
-
139
- isSubjectTypeFilterSupported() {
140
- return this.isStandardReportType() && this.standardReportCardType.isSubjectTypeFilterSupported();
141
- }
142
-
143
135
  }
144
136
 
145
137
  _defineProperty(ReportCard, "schema", {
package/dist/Schema.js CHANGED
@@ -279,7 +279,7 @@ function createRealmConfig() {
279
279
  return doCompact;
280
280
  },
281
281
  //order is important, should be arranged according to the dependency
282
- schemaVersion: 189,
282
+ schemaVersion: 190,
283
283
  onMigration: function (oldDB, newDB) {
284
284
  console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
285
285
  if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
@@ -902,8 +902,16 @@ function createRealmConfig() {
902
902
  // newDB.deleteModel("ProgramOutcome");
903
903
  }
904
904
 
905
- if (oldDB.schemaVersion < 189) {// PlaceHolder for SubjectType.User changes, so that people with previous version of client
906
- // are not able to use fastSync of version 189 and above
905
+ if (oldDB.schemaVersion < 189) {
906
+ _lodash.default.forEach(newDB.objects("SubjectType"), subjectType => {
907
+ if (!subjectType.settings) {
908
+ subjectType.settings = '{}';
909
+ }
910
+ });
911
+ }
912
+
913
+ if (oldDB.schemaVersion < 190) {// PlaceHolder for SubjectType.User changes, so that people with previous version of client
914
+ // are not able to use fastSync of version 190 and above
907
915
  }
908
916
  }
909
917
  };
@@ -118,10 +118,6 @@ class StandardReportCardType extends _BaseEntity.default {
118
118
  return typeToStatusMap[this.name];
119
119
  }
120
120
 
121
- isSubjectTypeFilterSupported() {
122
- return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits].includes(this.name);
123
- }
124
-
125
121
  }
126
122
 
127
123
  _defineProperty(StandardReportCardType, "schema", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.31.73",
4
+ "version": "1.31.74",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",