Skip to content

Commit

Permalink
PCQ-1969 adding tracer on continue to question button
Browse files Browse the repository at this point in the history
  • Loading branch information
priyankaVerma21 committed Aug 29, 2024
1 parent c4f3dbb commit 0eedfa5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
13 changes: 13 additions & 0 deletions app/middleware/continueToQuestions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

const appInsights = require('app/components/app-insights');

const continueToQuestions = (req, res, next) => {
if (req.originalUrl === '/start-page') {
appInsights.trackTrace({message: 'Continue to questions from start-page', properties: {['ServiceId']:req.session.form.serviceId}});
}
next();

};

module.exports = continueToQuestions;
5 changes: 4 additions & 1 deletion app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const validateParams = require('app/middleware/validateParams');
const optOut = require('app/middleware/optOut');
const returnToService = require('app/middleware/returnToService');
const startPageBackService = require('app/middleware/startPageBackService');
const continueToQuestions = require('app/middleware/continueToQuestions');
const featureToggle = new (require('app/utils/FeatureToggle'))();

router.use(initSession);
Expand All @@ -36,6 +37,8 @@ router.get('/return-to-service', returnToService);

router.get('/start-page-back-service', startPageBackService);

router.get('/continue-to-questions', continueToQuestions);

const allSteps = {
'en': initSteps([`${__dirname}/steps/ui`], 'en'),
'cy': initSteps([`${__dirname}/steps/ui`], 'cy')
Expand All @@ -53,7 +56,7 @@ router.use(async (req, res, next) => {

Object.entries(allSteps[req.session.language]).forEach(([, step]) => {
router.get(step.constructor.getUrl(), step.runner().GET(step));
router.post(step.constructor.getUrl(), step.runner().POST(step));
router.post(step.constructor.getUrl(), continueToQuestions, step.runner().POST(step));
});

res.locals.session = req.session;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "protected-characteristics-frontend",
"description": "Protected Characteristics web app",
"version": "1.2.186",
"version": "1.2.187",
"license": "MIT",
"engines": {
"node": ">=14.18.1"
Expand Down

0 comments on commit 0eedfa5

Please sign in to comment.