openchs-models 1.32.12 → 1.32.14

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.
package/dist/Schema.js CHANGED
@@ -283,7 +283,7 @@ function createRealmConfig() {
283
283
  return doCompact;
284
284
  },
285
285
  //order is important, should be arranged according to the dependency
286
- schemaVersion: 197,
286
+ schemaVersion: 198,
287
287
  onMigration: function (oldDB, newDB) {
288
288
  console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
289
289
  if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
@@ -937,7 +937,26 @@ function createRealmConfig() {
937
937
  }
938
938
 
939
939
  standardReportCardType.type = _lodash.default.replace(_lodash.default.startCase(standardReportCardType.description), new RegExp(' ', 'g'), '');
940
- });
940
+ }); //Reset MyDashboard cache because shape of filterJSON in cache has changed
941
+
942
+
943
+ const dashboardCache = newDB.objects("DashboardCache");
944
+ newDB.delete(dashboardCache);
945
+ }
946
+
947
+ if (oldDB.schemaVersion < 198) {
948
+ const oldObjects = oldDB.objects(_FormElementGroup.default.schema.name);
949
+ const newObjects = newDB.objects(_FormElementGroup.default.schema.name); // loop through all objects and set the name property in the
950
+ // new schema to display property
951
+
952
+ for (const objectIndex in oldObjects) {
953
+ const oldObject = oldObjects[objectIndex];
954
+ const newObject = newObjects[objectIndex];
955
+
956
+ if (!_lodash.default.isEmpty(oldObject.display) && oldObject.name !== oldObject.display) {
957
+ newObject.name = oldObject.display;
958
+ }
959
+ }
941
960
  }
942
961
  }
943
962
  };
@@ -48,14 +48,6 @@ class FormElementGroup extends _BaseEntity.default {
48
48
  this.that.displayOrder = x;
49
49
  }
50
50
 
51
- get display() {
52
- return this.that.display;
53
- }
54
-
55
- set display(x) {
56
- this.that.display = x;
57
- }
58
-
59
51
  get formElements() {
60
52
  return this.toEntityList("formElements", _FormElement.default);
61
53
  }
@@ -121,7 +113,7 @@ class FormElementGroup extends _BaseEntity.default {
121
113
  }
122
114
 
123
115
  static fromResource(resource, entityService) {
124
- const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "display", "voided", "rule", "startTime", "stayTime", "timed", "textColour", "backgroundColour"]);
116
+ const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "voided", "rule", "startTime", "stayTime", "timed", "textColour", "backgroundColour"]);
125
117
 
126
118
  formElementGroup.form = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "formUUID"), _Form.default.schema.name);
127
119
  return formElementGroup;
@@ -242,7 +234,7 @@ class FormElementGroup extends _BaseEntity.default {
242
234
  }
243
235
 
244
236
  get translatedFieldValue() {
245
- return this.display;
237
+ return this.name;
246
238
  }
247
239
 
248
240
  removeFormElement(formElementName) {
@@ -291,7 +283,6 @@ class FormElementGroup extends _BaseEntity.default {
291
283
  uuid: this.uuid,
292
284
  name: this.name,
293
285
  displayOrder: this.displayOrder,
294
- display: this.display,
295
286
  formElements: this.formElements,
296
287
  formUUID: this.form.uuid,
297
288
  startTime: this.startTime,
@@ -311,10 +302,6 @@ _defineProperty(FormElementGroup, "schema", {
311
302
  uuid: "string",
312
303
  name: "string",
313
304
  displayOrder: "double",
314
- display: {
315
- type: "string",
316
- optional: true
317
- },
318
305
  formElements: {
319
306
  type: "list",
320
307
  objectType: "FormElement"
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.32.12",
4
+ "version": "1.32.14",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",