Skip to content

Commit 3b5e2df

Browse files
Guard when to show consent page (#216)
1 parent d52e782 commit 3b5e2df

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

app/routes/events.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,19 @@ module.exports = (router) => {
12031203
rightBreastProcedures.includes('Breast implants') ||
12041204
leftBreastProcedures.includes('Breast implants')
12051205

1206-
if (hasBreastImplants) {
1206+
// Check if implants have been removed
1207+
const implantsRemoved =
1208+
Array.isArray(medicalHistoryTemp?.implantsRemoved) &&
1209+
medicalHistoryTemp.implantsRemoved.includes('Implants have been removed')
1210+
1211+
// Check if consent was already given (editing existing item)
1212+
const alreadyConsented = medicalHistoryTemp?.consentGiven
1213+
1214+
// Only show consent page if:
1215+
// - Breast implants are selected
1216+
// - AND implants have NOT been removed
1217+
// - AND consent has NOT already been given
1218+
if (hasBreastImplants && !implantsRemoved && !alreadyConsented) {
12071219
// Redirect to consent page immediately - we'll save the data after consent
12081220
return res.redirect(
12091221
urlWithReferrer(

0 commit comments

Comments
 (0)