openchs-models 1.33.57 → 1.33.59
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/AttendanceRecord.js +9 -9
- package/dist/Schema.js +11 -1
- package/dist/Session.js +2 -2
- package/package.json +1 -1
package/dist/AttendanceRecord.js
CHANGED
|
@@ -36,11 +36,11 @@ class AttendanceRecord extends _BaseEntity.default {
|
|
|
36
36
|
set status(x) {
|
|
37
37
|
this.that.status = x;
|
|
38
38
|
}
|
|
39
|
-
get
|
|
40
|
-
return this.that.
|
|
39
|
+
get reasonConceptUUIDs() {
|
|
40
|
+
return this.that.reasonConceptUUIDs || [];
|
|
41
41
|
}
|
|
42
|
-
set
|
|
43
|
-
this.that.
|
|
42
|
+
set reasonConceptUUIDs(x) {
|
|
43
|
+
this.that.reasonConceptUUIDs = x || [];
|
|
44
44
|
}
|
|
45
45
|
get followUpEncounterUUID() {
|
|
46
46
|
return this.that.followUpEncounterUUID;
|
|
@@ -90,7 +90,7 @@ class AttendanceRecord extends _BaseEntity.default {
|
|
|
90
90
|
record.sessionUUID = resource.sessionUUID;
|
|
91
91
|
record.subjectUUID = resource.subjectUUID;
|
|
92
92
|
record.status = resource.status;
|
|
93
|
-
record.
|
|
93
|
+
record.reasonConceptUUIDs = Array.isArray(resource.reasonConceptUUIDs) ? resource.reasonConceptUUIDs : resource.reasonConceptUUID ? [resource.reasonConceptUUID] : [];
|
|
94
94
|
record.followUpEncounterUUID = resource.followUpEncounterUUID || null;
|
|
95
95
|
record.needsFollowUp = !!resource.needsFollowUp;
|
|
96
96
|
record.voided = !!resource.voided;
|
|
@@ -99,7 +99,7 @@ class AttendanceRecord extends _BaseEntity.default {
|
|
|
99
99
|
}
|
|
100
100
|
get toResource() {
|
|
101
101
|
const resource = _lodash.default.pick(this, ["uuid", "sessionUUID", "subjectUUID", "status", "voided"]);
|
|
102
|
-
resource.
|
|
102
|
+
resource.reasonConceptUUIDs = this.reasonConceptUUIDs || [];
|
|
103
103
|
resource.followUpEncounterUUID = this.followUpEncounterUUID || null;
|
|
104
104
|
resource.needsFollowUp = !!this.needsFollowUp;
|
|
105
105
|
return resource;
|
|
@@ -113,9 +113,9 @@ _defineProperty(AttendanceRecord, "schema", {
|
|
|
113
113
|
sessionUUID: "string",
|
|
114
114
|
subjectUUID: "string",
|
|
115
115
|
status: "string",
|
|
116
|
-
|
|
117
|
-
type: "string",
|
|
118
|
-
|
|
116
|
+
reasonConceptUUIDs: {
|
|
117
|
+
type: "string[]",
|
|
118
|
+
default: []
|
|
119
119
|
},
|
|
120
120
|
followUpEncounterUUID: {
|
|
121
121
|
type: "string",
|
package/dist/Schema.js
CHANGED
|
@@ -186,7 +186,7 @@ function createRealmConfig() {
|
|
|
186
186
|
return doCompact;
|
|
187
187
|
},
|
|
188
188
|
//order is important, should be arranged according to the dependency
|
|
189
|
-
schemaVersion:
|
|
189
|
+
schemaVersion: 215,
|
|
190
190
|
onMigration: function (oldDB, newDB) {
|
|
191
191
|
console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
|
|
192
192
|
if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
|
|
@@ -836,6 +836,16 @@ function createRealmConfig() {
|
|
|
836
836
|
rec.needsFollowUp = !_lodash.default.isNil(rec.followUpEncounterUUID);
|
|
837
837
|
});
|
|
838
838
|
}
|
|
839
|
+
if (oldDB.schemaVersion < 215) {
|
|
840
|
+
// reasonConceptUUID (single, optional) -> reasonConceptUUIDs (string[]).
|
|
841
|
+
// A set reason becomes a one-element array; null becomes [].
|
|
842
|
+
const oldRecords = oldDB.objects(_SchemaNames.default.AttendanceRecord);
|
|
843
|
+
const newRecords = newDB.objects(_SchemaNames.default.AttendanceRecord);
|
|
844
|
+
for (let i = 0; i < oldRecords.length; i++) {
|
|
845
|
+
const reason = oldRecords[i].reasonConceptUUID;
|
|
846
|
+
newRecords[i].reasonConceptUUIDs = _lodash.default.isNil(reason) ? [] : [reason];
|
|
847
|
+
}
|
|
848
|
+
}
|
|
839
849
|
}
|
|
840
850
|
};
|
|
841
851
|
}
|
package/dist/Session.js
CHANGED
|
@@ -106,7 +106,7 @@ class Session extends _BaseEntity.default {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// Caller iterates the returned records and persists them in the same realm.write.
|
|
109
|
-
// rosterByStudentUUID: { [studentUUID]: { status: 'Present'|'Absent',
|
|
109
|
+
// rosterByStudentUUID: { [studentUUID]: { status: 'Present'|'Absent', reasonConceptUUIDs?: string[] } }
|
|
110
110
|
// reasonConceptUUID: optional session-level reason. Required by the server for
|
|
111
111
|
// Mark-Anyway-Held (Held on weekly_off/public_holiday); ignored on a working day.
|
|
112
112
|
// Default null preserves prior semantics (e.g. re-mark-Held after DidntHappen
|
|
@@ -122,7 +122,7 @@ class Session extends _BaseEntity.default {
|
|
|
122
122
|
record.sessionUUID = this.uuid;
|
|
123
123
|
record.subjectUUID = studentUUID;
|
|
124
124
|
record.status = entry.status;
|
|
125
|
-
record.
|
|
125
|
+
record.reasonConceptUUIDs = entry.reasonConceptUUIDs || [];
|
|
126
126
|
record.followUpEncounterUUID = null;
|
|
127
127
|
record.voided = false;
|
|
128
128
|
records.push(record);
|