Wrong argument in req.session.data in Getting started part 7
See original GitHub issueDescription of the issue
There is an error in part 7 of the Getting started tutorial, which does not allow the form to go as intended. If we give an answer other than “3 or more” we should be redirected to “ineligible.html” page. What does happen at the moment is that no matter what answer we choose, we will always be redirected to “ineligible.html”.
Steps to reproduce the issue
Doing the tutorial as intended, in part 7 we stumble across this code:
`router.post(‘/juggling-balls-answer’, function (req, res) { // Make a variable and give it the value from ‘juggling-balls’ var jugglingBalls = req.session.data[‘juggling-balls’]
// Check whether the variable matches a condition if (jugglingBalls == “3 or more”){ // Send user to next page res.redirect(‘/juggling-trick’) } else { // Send user to ineligible page res.redirect(‘/ineligible’) }
})`
Where in part 4 we are asked to set the name and idPrefix of the form in “juggling-balls.html” to “how-many-balls”, like this:
{{ govukRadios({ idPrefix: “how-many-balls”, name: “how-many-balls”, fieldset: { legend: { text: “How many balls can you juggle?”, isPageHeading: true, classes: “govuk-fieldset__legend–l” }
Actual vs expected behaviour
We expect the program to redirect us to ‘ineligible.html’ when we choose the wrong answer. It happens will all the answer, because the data argument is wrong. That is why no matter the answer, we are always redirected to ‘ineligible.html’.
It is:
var jugglingBalls = req.session.data['juggling-balls']
and should be
var jugglingBalls = req.session.data['how-many-balls']
as instructed in part 4.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
@joelanman @vanitabarrett Thank you very much. I have informed my colleagues and the mentor about the issue and the use of the tutorial on the website instead of the one provided in the download.
I would like to make a suggestion, to place a message on the index.html that says something about the local copy’s tutorial not always being up to date, so it is the first thing that someone new sees.
Best regards, Sebastian
Hi @sebastianczajkowski, yes you’re right - unfortunately the main site is updated automatically but the downloaded copy requires the team to manually release any changes in a new version and we don’t always do that straight away. I would suggest trying to use the docs on the website as much as possible. All the docs that are available in the download are also included on the website and, as @joelanman said, are updated more frequently.