Skip to content

Commit 3e87bc6

Browse files
Fix flow for same vax different patient (#517)
This fixes the flow for changing the answers for eligibility or role from a previous vaccination when recording the same vaccination for the next patient.
1 parent ba11d87 commit 3e87bc6

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

app/routes/record-vaccinations.js

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ module.exports = router => {
548548

549549
router.get('/record-vaccinations/eligibility', (req, res) => {
550550
const data = req.session.data
551+
const from = req.query.from
551552
const eligibility = data.eligibility
552553
let errors = []
553554

@@ -561,7 +562,8 @@ module.exports = router => {
561562
}
562563

563564
res.render('record-vaccinations/eligibility', {
564-
errors
565+
errors,
566+
from
565567
})
566568
})
567569

@@ -583,16 +585,22 @@ module.exports = router => {
583585
nextPage = "/record-vaccinations/patient-history"
584586
}
585587

586-
} else if (data.vaccine == "flu") {
587-
if (data.eligibility === "Health or social care worker") {
588-
nextPage = "/record-vaccinations/healthcare-worker"
589-
} else {
590-
nextPage = "/record-vaccinations/patient"
591-
}
592-
} else if (data.vaccine == "COVID-19") {
588+
} else if (data.vaccine == "flu" && data.eligibility === "Health or social care worker" && (!data.healthcareWorker || data.healthcareWorker === "")) {
589+
590+
nextPage = "/record-vaccinations/healthcare-worker"
591+
592+
} else if (data.vaccine == "COVID-19" && (!data.locationType || data.locationType === "")) {
593+
593594
nextPage = "/record-vaccinations/location"
595+
596+
} else if (data.repeatVaccination === "yes") {
597+
598+
nextPage = "/record-vaccinations/review-previous"
599+
594600
} else {
601+
595602
nextPage = "/record-vaccinations/patient"
603+
596604
}
597605

598606
res.redirect(nextPage)
@@ -695,10 +703,12 @@ module.exports = router => {
695703
const healthcareWorker = data.healthcareWorker
696704
let nextPage
697705

698-
if (healthcareWorker && healthcareWorker != '') {
699-
nextPage = '/record-vaccinations/location'
700-
} else {
706+
if (!healthcareWorker || healthcareWorker === '') {
701707
nextPage = '/record-vaccinations/healthcare-worker?showErrors=yes'
708+
} else if (data.repeatVaccination === "yes") {
709+
nextPage = '/record-vaccinations/review-previous'
710+
} else {
711+
nextPage = '/record-vaccinations/location'
702712
}
703713

704714
res.redirect(nextPage)
@@ -737,7 +747,7 @@ module.exports = router => {
737747
data.newBatchNumber = ""
738748
}
739749

740-
res.redirect('/record-vaccinations/review-previous')
750+
res.redirect('/record-vaccinations/review-previous?repeatVaccination=yes&repeatPatient=no')
741751

742752
} else if (answer === 'same-patient-another-vaccination') {
743753

@@ -759,7 +769,7 @@ module.exports = router => {
759769
req.session.data.legalMechanism = ""
760770
req.session.data.healthcareWorker = ""
761771

762-
res.redirect('/record-vaccinations/vaccine')
772+
res.redirect('/record-vaccinations/vaccine?repeatPatient=no&repeatVaccination=no')
763773
} else {
764774
res.redirect('/record-vaccinations/done?showErrors=yes')
765775
}

app/views/record-vaccinations/eligibility.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
{% set currentSection = "vaccinate" %}
66

77
{% block beforeContent %}
8-
{{ backLink({ href: "/record-vaccinations/legal-mechanism" }) }}
8+
{% set backHref = from if from else "/record-vaccinations/legal-mechanism" %}
9+
10+
{{ backLink({ href: backHref }) }}
911
{% endblock %}
1012

1113
{% set CovidEligibilityOptions = [

app/views/record-vaccinations/review-previous.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ <h1 class="nhsuk-heading-l">{{ pageName }}</h1>
128128
actions: {
129129
items: [
130130
{
131-
href: "/record-vaccinations/eligibility",
131+
href: "/record-vaccinations/eligibility?from=/record-vaccinations/review-previous",
132132
text: "Change",
133133
visuallyHiddenText: "eligibility"
134134
}

0 commit comments

Comments
 (0)