@@ -63,15 +63,23 @@ export const replyController = {
6363 patient_uuid : patientSession . patient . uuid ,
6464 programme_id : patientSession . programme . id ,
6565 session_id : patientSession . session . id ,
66- createdBy_uid : account . uid
66+ createdBy_uid : account . uid ,
67+ selfConsent : patientSession ?. patient ?. post16
6768 } ,
6869 data
6970 )
7071
7172 // TODO: Use presenter
7273 const reply = new Reply ( createdReply , data )
7374
74- response . redirect ( `${ reply . uri } /new/respondent` )
75+ let next
76+ if ( patientSession ?. patient ?. post16 ) {
77+ next = `${ reply . uri } /new/decision`
78+ } else {
79+ next = `${ reply . uri } /new/respondent`
80+ }
81+
82+ response . redirect ( next )
7583 } ,
7684
7785 update ( type ) {
@@ -180,10 +188,6 @@ export const replyController = {
180188 response . locals . reply = new Reply ( reply , data )
181189 response . locals . patient = patientSession . patient
182190
183- // Child can self consent if assessed as Gillick competent
184- const canSelfConsent =
185- patientSession . gillick ?. competent === GillickCompetent . True
186-
187191 // Only ask for programme if more than 1 administered in a session
188192 const isMultiProgrammeSession =
189193 patientSession . session . programmes . length > 1
@@ -215,7 +219,7 @@ export const replyController = {
215219 [ `/${ reply_uuid } /${ type } /programme` ] : { }
216220 } ) ,
217221 [ `/${ reply_uuid } /${ type } /decision` ] : {
218- [ `/${ reply_uuid } /${ type } /${ reply ?. selfConsent ? 'notify-parent' : 'health-answers' } ` ] :
222+ [ `/${ reply_uuid } /${ type } /${ reply ?. selfConsent && ! patientSession . patient . post16 ? 'notify-parent' : 'health-answers' } ` ] :
219223 {
220224 data : 'reply.decision' ,
221225 value : ReplyDecision . Given
@@ -291,9 +295,10 @@ export const replyController = {
291295 )
292296 }
293297
294- if ( canSelfConsent ) {
298+ // Child can self consent if assessed as Gillick competent
299+ if ( patientSession . gillick ?. competent === GillickCompetent . True ) {
295300 response . locals . respondentItems . unshift ( {
296- text : 'Child (Gillick competent)' ,
301+ text : ` ${ reply ?. patient ?. fullName } (child)` ,
297302 value : 'self'
298303 } )
299304 }
0 commit comments