openchs-models 1.33.54 → 1.33.55

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.
@@ -15,7 +15,6 @@ var _EncounterType = _interopRequireDefault(require("./EncounterType"));
15
15
  var _Duration = _interopRequireDefault(require("./Duration"));
16
16
  var _NestedReportCardResult = _interopRequireDefault(require("./reports/NestedReportCardResult"));
17
17
  var _CustomCardConfig = _interopRequireDefault(require("./CustomCardConfig"));
18
- var _AttendanceType = _interopRequireDefault(require("./AttendanceType"));
19
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
19
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
21
20
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -152,9 +151,6 @@ class ReportCard extends _BaseEntity.default {
152
151
  if (resource.actionDetail.encounterTypeUUID) {
153
152
  reportCard.actionDetailEncounterType = entityService.findByUUID(resource.actionDetail.encounterTypeUUID, _EncounterType.default.schema.name);
154
153
  }
155
- if (resource.actionDetail.attendanceTypeUUID) {
156
- reportCard.actionDetailAttendanceType = entityService.findByUUID(resource.actionDetail.attendanceTypeUUID, _AttendanceType.default.schema.name);
157
- }
158
154
  reportCard.actionDetailVisitType = resource.actionDetail.visitType || null;
159
155
  }
160
156
  reportCard.customCardConfig = entityService.findByUUID(_ResourceUtil.default.getUUIDFor(resource, "customCardConfigUUID"), _CustomCardConfig.default.schema.name);
@@ -221,12 +217,6 @@ class ReportCard extends _BaseEntity.default {
221
217
  set actionDetailVisitType(x) {
222
218
  this.that.actionDetailVisitType = x;
223
219
  }
224
- get actionDetailAttendanceType() {
225
- return this.toEntity("actionDetailAttendanceType", _AttendanceType.default);
226
- }
227
- set actionDetailAttendanceType(x) {
228
- this.that.actionDetailAttendanceType = this.fromObject(x);
229
- }
230
220
  get onActionCompletion() {
231
221
  return this.that.onActionCompletion;
232
222
  }
@@ -236,9 +226,6 @@ class ReportCard extends _BaseEntity.default {
236
226
  isActionDoVisit() {
237
227
  return this.action === ReportCard.actionTypes.DoVisit;
238
228
  }
239
- isActionMarkAttendance() {
240
- return this.action === ReportCard.actionTypes.MarkAttendance;
241
- }
242
229
  isScheduledVisitType() {
243
230
  return this.actionDetailVisitType === ReportCard.visitTypes.Scheduled;
244
231
  }
@@ -265,8 +252,7 @@ _defineProperty(ReportCard, "cardTypes", {
265
252
  });
266
253
  _defineProperty(ReportCard, "actionTypes", {
267
254
  ViewSubjectProfile: "ViewSubjectProfile",
268
- DoVisit: "DoVisit",
269
- MarkAttendance: "MarkAttendance"
255
+ DoVisit: "DoVisit"
270
256
  });
271
257
  _defineProperty(ReportCard, "visitTypes", {
272
258
  Scheduled: "Scheduled",
@@ -350,11 +336,6 @@ _defineProperty(ReportCard, "schema", {
350
336
  type: "string",
351
337
  optional: true
352
338
  },
353
- actionDetailAttendanceType: {
354
- type: "object",
355
- objectType: "AttendanceType",
356
- optional: true
357
- },
358
339
  onActionCompletion: {
359
340
  type: "string",
360
341
  optional: true
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: 213,
189
+ schemaVersion: 212,
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.`);
@@ -823,11 +823,6 @@ function createRealmConfig() {
823
823
  // (bool default false). Realm backfills the new boolean and the new
824
824
  // schemas have no pre-existing rows.
825
825
  }
826
- if (oldDB.schemaVersion < 213) {
827
- // Additive: ReportCard.actionDetailAttendanceType (optional ref to
828
- // AttendanceType) for the new MarkAttendance action. Existing rows
829
- // remain null.
830
- }
831
826
  }
832
827
  };
833
828
  }
package/dist/Session.js CHANGED
@@ -163,13 +163,19 @@ class Session extends _BaseEntity.default {
163
163
  const followUpEncounterTypeUUID = attendanceType.getFollowUpEncounterTypeUUID();
164
164
  if (!followUpEncounterTypeUUID) return [];
165
165
  if (!encounterType) return [];
166
- const startOfToday = (0, _moment.default)().startOf("day").toDate();
167
- const maxVisit = (0, _moment.default)().startOf("day").add(2, "days").toDate();
166
+ const base = (0, _moment.default)(this.scheduledDate).startOf("day");
167
+ const earliestVisit = base.clone().toDate();
168
+ const maxVisit = base.clone().add(2, "days").toDate();
168
169
  const created = [];
169
170
  _lodash.default.forEach(attendanceRecords || [], record => {
170
171
  if (!record) return;
171
172
  if (record.status !== _AttendanceRecord.default.status.ABSENT) return;
172
173
  if (!_lodash.default.isNil(record.reasonConceptUUID)) return;
174
+ // Re-mark path: an existing AttendanceRecord may already point at a
175
+ // previously-created follow-up encounter. Don't create a second one —
176
+ // leave the link in place; voidStaleFollowUps handles the inverse case
177
+ // (student transitioned out of "absent-no-reason").
178
+ if (record.followUpEncounterUUID) return;
173
179
  const student = studentLookup ? studentLookup(record.subjectUUID) : null;
174
180
  if (!student) return;
175
181
  let encounter;
@@ -180,7 +186,7 @@ class Session extends _BaseEntity.default {
180
186
  encounter.uuid = _General.default.randomUUID();
181
187
  encounter.encounterType = encounterType;
182
188
  encounter.programEnrolment = enrolment;
183
- encounter.earliestVisitDateTime = startOfToday;
189
+ encounter.earliestVisitDateTime = earliestVisit;
184
190
  encounter.maxVisitDateTime = maxVisit;
185
191
  encounter.observations = [];
186
192
  encounter.cancelObservations = [];
@@ -190,7 +196,7 @@ class Session extends _BaseEntity.default {
190
196
  encounter.uuid = _General.default.randomUUID();
191
197
  encounter.encounterType = encounterType;
192
198
  encounter.individual = student;
193
- encounter.earliestVisitDateTime = startOfToday;
199
+ encounter.earliestVisitDateTime = earliestVisit;
194
200
  encounter.maxVisitDateTime = maxVisit;
195
201
  encounter.observations = [];
196
202
  encounter.cancelObservations = [];
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.33.54",
4
+ "version": "1.33.55",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",