Skip to content

Commit 8fd57f1

Browse files
Add Reply.fullNameAndRelationship
1 parent 33febab commit 8fd57f1

1 file changed

Lines changed: 24 additions & 16 deletions

File tree

app/models/reply.js

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,30 @@ export class Reply {
161161
}
162162
}
163163

164+
/**
165+
* Get respondent’s relationship to child
166+
*
167+
* @returns {string|undefined} Relationship to child
168+
*/
169+
get relationship() {
170+
if (this.parent) {
171+
return this.parent.relationship
172+
} else if (this.child) {
173+
return 'Child (Gillick competent)'
174+
}
175+
}
176+
177+
/**
178+
* Get full name and relationship to child
179+
*
180+
* @returns {string} Full name and relationship
181+
*/
182+
get fullNameAndRelationship() {
183+
return this.selfConsent
184+
? this.relationship
185+
: formatParent(this.parent, false)
186+
}
187+
164188
/**
165189
* Was the consent response delivered?
166190
*
@@ -181,19 +205,6 @@ export class Reply {
181205
return hasEmailGotEmail || hasTelSmsGotSms
182206
}
183207

184-
/**
185-
* Get respondent’s relationship to child
186-
*
187-
* @returns {string|undefined} Relationship to child
188-
*/
189-
get relationship() {
190-
if (this.parent) {
191-
return this.parent.relationship
192-
} else if (this.child) {
193-
return 'Child (Gillick competent)'
194-
}
195-
}
196-
197208
/**
198209
* Get user who created reply
199210
*
@@ -399,9 +410,6 @@ export class Reply {
399410
}),
400411
createdBy: this.createdBy?.fullName || '',
401412
decisionStatus,
402-
fullNameAndRelationship: this.selfConsent
403-
? this.relationship
404-
: formatParent(this.parent, false),
405413
parent: formatParent(this.parent, true),
406414
tel: this.parent && this.parent.tel,
407415
email: this.parent && this.parent.email,

0 commit comments

Comments
 (0)