From 83eb705fe7f59bd385602babfe2c2cd231305939 Mon Sep 17 00:00:00 2001 From: 9sneha-n <9sneha.n@gmail.com> Date: Thu, 17 Oct 2024 15:57:12 +0530 Subject: [PATCH] feat: risk custom question fix --- src/webapp/pages/form-page/mapFormStateToEntityData.ts | 3 ++- .../risk-assessment/mapRiskAssessmentToInitialFormState.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/webapp/pages/form-page/mapFormStateToEntityData.ts b/src/webapp/pages/form-page/mapFormStateToEntityData.ts index a8643690..00c4f746 100644 --- a/src/webapp/pages/form-page/mapFormStateToEntityData.ts +++ b/src/webapp/pages/form-page/mapFormStateToEntityData.ts @@ -460,8 +460,9 @@ function mapFormStateToRiskAssessmentQuestionnaire( formData.options, index.toString() ); + const idWithoutIdentifier = customSection.id.replace("additionalQuestions", ""); return { - id: customSection.id.replace("additionalQuestions", ""), + id: idWithoutIdentifier.length < 11 ? "" : idWithoutIdentifier, //TO DO : Temp fix question: allFields.find(field => field.id.includes(`custom-question${index}`)) ?.value as string, likelihood: likelihoodOption, diff --git a/src/webapp/pages/form-page/risk-assessment/mapRiskAssessmentToInitialFormState.ts b/src/webapp/pages/form-page/risk-assessment/mapRiskAssessmentToInitialFormState.ts index 1c52f5ac..8114f08c 100644 --- a/src/webapp/pages/form-page/risk-assessment/mapRiskAssessmentToInitialFormState.ts +++ b/src/webapp/pages/form-page/risk-assessment/mapRiskAssessmentToInitialFormState.ts @@ -754,7 +754,7 @@ function getRiskAssessmentCustomQuestionSection( options; const riskAssesssmentQuestionFormSection: FormSectionState = { title: title, - id: questionId ? `${id}${questionId}` : `${id}`, + id: questionId ? `${id}${questionId}` : `${id}${index}`, isVisible: true, fields: [ {