openchs-models 1.32.14 → 1.32.16

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: 198,
286
+ schemaVersion: 197,
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.`);
@@ -923,6 +923,13 @@ function createRealmConfig() {
923
923
  }
924
924
 
925
925
  if (oldDB.schemaVersion < 197) {
926
+ _lodash.default.forEach(newDB.objects("ReportCard"), reportCard => {
927
+ if (reportCard.standardReportCardType && ['Last 24 hours registrations', 'Last 24 hours enrolments', 'Last 24 hours visits'].includes(reportCard.standardReportCardType.name)) reportCard.standardReportCardInputRecentDurationJSON = JSON.stringify({
928
+ value: "1",
929
+ unit: "days"
930
+ });
931
+ });
932
+
926
933
  _lodash.default.forEach(newDB.objects("StandardReportCardType"), standardReportCardType => {
927
934
  if (standardReportCardType.name === 'Last 24 hours registrations') {
928
935
  standardReportCardType.description = 'Recent registrations';
@@ -943,21 +950,6 @@ function createRealmConfig() {
943
950
  const dashboardCache = newDB.objects("DashboardCache");
944
951
  newDB.delete(dashboardCache);
945
952
  }
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
- }
960
- }
961
953
  }
962
954
  };
963
955
  }
@@ -48,6 +48,14 @@ 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
+
51
59
  get formElements() {
52
60
  return this.toEntityList("formElements", _FormElement.default);
53
61
  }
@@ -113,7 +121,7 @@ class FormElementGroup extends _BaseEntity.default {
113
121
  }
114
122
 
115
123
  static fromResource(resource, entityService) {
116
- const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "voided", "rule", "startTime", "stayTime", "timed", "textColour", "backgroundColour"]);
124
+ const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "display", "voided", "rule", "startTime", "stayTime", "timed", "textColour", "backgroundColour"]);
117
125
 
118
126
  formElementGroup.form = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "formUUID"), _Form.default.schema.name);
119
127
  return formElementGroup;
@@ -234,7 +242,7 @@ class FormElementGroup extends _BaseEntity.default {
234
242
  }
235
243
 
236
244
  get translatedFieldValue() {
237
- return this.name;
245
+ return this.display;
238
246
  }
239
247
 
240
248
  removeFormElement(formElementName) {
@@ -283,6 +291,7 @@ class FormElementGroup extends _BaseEntity.default {
283
291
  uuid: this.uuid,
284
292
  name: this.name,
285
293
  displayOrder: this.displayOrder,
294
+ display: this.display,
286
295
  formElements: this.formElements,
287
296
  formUUID: this.form.uuid,
288
297
  startTime: this.startTime,
@@ -302,6 +311,10 @@ _defineProperty(FormElementGroup, "schema", {
302
311
  uuid: "string",
303
312
  name: "string",
304
313
  displayOrder: "double",
314
+ display: {
315
+ type: "string",
316
+ optional: true
317
+ },
305
318
  formElements: {
306
319
  type: "list",
307
320
  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.14",
4
+ "version": "1.32.16",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",