Skip to content

Commit f8e603e

Browse files
authored
Swap use of global.booleanItems constant for a function call (#245)
Background is that there'd been an instance where a set of boolean items on one page in a journey had ended up recording values for boolean items on a completely separate page. It was like the latter had injected itself into the earlier page via the constant. Happened both locally and on Heroku.
1 parent a1747c7 commit f8e603e

18 files changed

Lines changed: 22 additions & 32 deletions

File tree

app/globals.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ import {
2424
export default () => {
2525
const globals = {}
2626

27-
/**
28-
* Get boolean form field items
29-
*
30-
* @returns {object} Form field items
31-
*/
32-
globals.booleanItems = [
33-
{ text: 'Yes', value: true },
34-
{ text: 'No', value: false }
35-
]
36-
3727
/**
3828
* Get boolean form field items
3929
*

app/views/book-into-a-clinic/form/extra-time.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
label: { text: __("clinicBooking.extraTime.reason.label") },
99
decorate: "appointment.extraTimeReason"
1010
}) %}
11-
{% set items = injectConditionalHtml(booleanItems, true, yesHtml) %}
11+
{% set items = injectConditionalHtml(getBooleanItems(), true, yesHtml) %}
1212

1313
{{ radios({
1414
fieldset: {

app/views/parent/form/parent.njk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
legend: { text: __("consent.parent.hasParentalResponsibility.label") }
1818
},
1919
hint: { text: __("consent.parent.hasParentalResponsibility.hint") },
20-
items: booleanItems,
20+
items: getBooleanItems(),
2121
decorate: "consent.parent.hasParentalResponsibility"
2222
}) %}
2323

@@ -29,7 +29,7 @@
2929
legend: { text: __("consent.parent.hasParentalResponsibility.label") }
3030
},
3131
hint: { text: __("consent.parent.hasParentalResponsibility.hint") },
32-
items: booleanItems,
32+
items: getBooleanItems(),
3333
decorate: "consent.parent.hasParentalResponsibility"
3434
}) %}
3535

app/views/patient-session/_note.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
hint: { text: __("event.pinned.hint") },
2121
inline: true,
22-
items: booleanItems,
22+
items: getBooleanItems(),
2323
decorate: "pinned"
2424
}) }}
2525

app/views/patient-session/_triage.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
{% set psdRadiosHtml = radios({
6363
fieldset: { legend: { text: __("triage.psd.label") } },
6464
inline: true,
65-
items: booleanItems,
65+
items: getBooleanItems(),
6666
decorate: "triage.psd"
6767
}) if account.canPrescribe %}
6868

app/views/patient-session/form/gillick.njk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
legend: { text: __("patientSession.gillick.q1.label") }
1919
},
2020
inline: true,
21-
items: booleanItems,
21+
items: getBooleanItems(),
2222
decorate: "patientSession.gillick.q1"
2323
}) }}
2424

@@ -27,7 +27,7 @@
2727
legend: { text: __("patientSession.gillick.q2.label") }
2828
},
2929
inline: true,
30-
items: booleanItems,
30+
items: getBooleanItems(),
3131
decorate: "patientSession.gillick.q2"
3232
}) }}
3333

@@ -36,7 +36,7 @@
3636
legend: { text: __("patientSession.gillick.q3.label") }
3737
},
3838
inline: true,
39-
items: booleanItems,
39+
items: getBooleanItems(),
4040
decorate: "patientSession.gillick.q3"
4141
}) }}
4242

@@ -45,7 +45,7 @@
4545
legend: { text: __("patientSession.gillick.q4.label") }
4646
},
4747
inline: true,
48-
items: booleanItems,
48+
items: getBooleanItems(),
4949
decorate: "patientSession.gillick.q4"
5050
}) }}
5151

@@ -54,7 +54,7 @@
5454
legend: { text: __("patientSession.gillick.q5.label") }
5555
},
5656
inline: true,
57-
items: booleanItems,
57+
items: getBooleanItems(),
5858
decorate: "patientSession.gillick.q5"
5959
}) }}
6060

app/views/patient-session/form/triage.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{% set psdRadiosHtml = radios({
1212
fieldset: { legend: { text: __("triage.psd.label") } },
1313
inline: true,
14-
items: booleanItems,
14+
items: getBooleanItems(),
1515
decorate: "triage.psd"
1616
}) if account.canPrescribe %}
1717

app/views/reply/form/decision.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
}
3030
},
3131
hint: { text: __("reply.alternative.hint") },
32-
items: booleanItems,
32+
items: getBooleanItems(),
3333
decorate: "reply.alternative"
3434
})
3535
} if programme.alternativeVaccine

app/views/reply/form/follow-up.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
text: __("reply.follow-up.decision.label")
4141
}
4242
},
43-
items: booleanItems,
43+
items: getBooleanItems(),
4444
decorate: "decision"
4545
}) }}
4646
{% endblock %}

app/views/reply/form/notify-parent.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
})
1313
}
1414
},
15-
items: booleanItems,
15+
items: getBooleanItems(),
1616
decorate: "reply.parent.notify"
1717
}) }}
1818
{% endblock %}

0 commit comments

Comments
 (0)