Skip to content

Commit ebd3b49

Browse files
Fix pre-screening data creation
1 parent a56bb0e commit ebd3b49

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

app/models/patient-session.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,7 @@ export class PatientSession {
10171017
this.patient.addEvent({
10181018
name: 'Completed pre-screening checks',
10191019
note: event.note,
1020+
createdAt: event.createdAt,
10201021
createdBy_uid: event.createdBy_uid,
10211022
programme_ids: this.session.programme_ids
10221023
})

lib/create-data.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import process from 'node:process'
22

33
import { faker } from '@faker-js/faker'
4-
import { isSameDay } from 'date-fns'
4+
import { addMinutes, isSameDay } from 'date-fns'
55
import 'dotenv/config'
66

77
import clinicsData from '../app/datasets/clinics.js'
@@ -452,18 +452,18 @@ for (const patientSession of Object.values(context.patientSessions)) {
452452

453453
const vaccinatedInSchool = faker.datatype.boolean(0.8)
454454
if (vaccinatedInSchool) {
455-
// REGISTER attendance (15 minutes before vaccination)
455+
// REGISTER attendance (10 minutes before vaccination)
456456
patientSession.registerAttendance(
457457
{
458-
createdAt: new Date(vaccination.createdAt.getTime() - 15 * 60000),
458+
createdAt: addMinutes(vaccination.createdAt, -10),
459459
createdBy_uid: nurse.uid
460460
},
461461
RegistrationOutcome.Present
462462
)
463463

464-
// PRE-SCREEN
464+
// PRE-SCREEN (5 minutes before vaccination)
465465
patientSession.preScreen({
466-
createdAt: new Date(vaccination.createdAt.getTime() - 10 * 60000),
466+
createdAt: addMinutes(vaccination.createdAt, -5),
467467
createdBy_uid: nurse.uid
468468
})
469469

0 commit comments

Comments
 (0)