cds-snc / c19-benefits-node

Answer some questions to find which federal programs can help you https://covid-benefits.alpha.canada.ca/. - Répondez à quelques questions pour trouver quels programmes d’aide financière fédéraux s’offrent à vous https://covid-prestations.alpha.canada.ca/.
MIT License
2 stars 4 forks source link

Don't clear all session data on start / start over #474

Closed dsamojlenko closed 4 years ago

dsamojlenko commented 4 years ago

Closes #473

This change will clear only the collected form data when visiting /clear or /en/start, rather than the whole session.

Previously, we would do this on those routes:

req.session = null

This had the effect of clearing the entire session. But what we really need is to just clear the formdata so that the user can start fresh. If we preserve the rest of the session (which also contains the session id), then we can track users as they complete different flows (ie, they go through the service once, start over, and go through it again).

The above code has been changed to this:

req.session.formdata = null

This was raised as part of Researchers desire to understand if a user is submitting feedback from the start page, it would be helpful to know if they only visited the start page, or if they had already gone through the service once and didn't find what they needed.

This is a tough one to test, but here's the log output of the effect:

image

The highlighted rows are when a user clicks "Start Over" - note that their session id is maintained as they return to the beginning of the process.