Skip to content

Commit cc039d7

Browse files
Make Patient.addNotice more fault tolerant
1 parent b9a8a35 commit cc039d7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

app/models/patient.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -687,23 +687,23 @@ export class Patient extends Child {
687687
*/
688688
addNotice(notice) {
689689
let name
690-
switch (notice.type) {
691-
case NoticeType.Deceased:
690+
switch (true) {
691+
case notice.type === NoticeType.Deceased:
692692
// Update patient record with date of death
693693
this.dod = removeDays(today(), 5)
694694
name = `Record updated with child’s date of death`
695695
break
696-
case NoticeType.NoNotify:
696+
case notice.type === NoticeType.NoNotify && this.parent1?.notify:
697697
// Notify request to not share vaccination with GP
698698
this.parent1.notify = false
699699
name = `Child gave consent for HPV and flu vaccinations under Gillick competence and does not want their parents to be notified.\n\nThese records are not automatically synced with GP records.\n\nYour team must let the child’s GP know they were vaccinated.`
700700
break
701-
case NoticeType.Invalid:
701+
case notice.type === NoticeType.Invalid:
702702
// Flag record as invalid
703703
this.invalid = true
704704
name = `Record flagged as invalid`
705705
break
706-
case NoticeType.Sensitive:
706+
case notice.type === NoticeType.Sensitive:
707707
// Flag record as sensitive
708708
this.sensitive = true
709709
name = `Record flagged as sensitive`

0 commit comments

Comments
 (0)