Skip to content

Commit

Permalink
fix: parse index in risk custom question
Browse files Browse the repository at this point in the history
  • Loading branch information
9sneha-n committed Oct 22, 2024
1 parent 958402c commit 8a23e17
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/webapp/pages/form-page/mapFormStateToEntityData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ function mapFormStateToRiskAssessmentQuestionnaire(
formData.options,
index.toString()
);
const idWithoutIdentifier = customSection.id.replace("additionalQuestions", "");

return {
id: idWithoutIdentifier.length < 11 ? "" : idWithoutIdentifier, //TO DO : Temp fix
id: customSection.id.replace("additionalQuestions", "").replace(`_${index}`, ""),
question: allFields.find(field => field.id.includes(`custom-question${index}`))
?.value as string,
likelihood: likelihoodOption,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ function getRiskAssessmentCustomQuestionSection(
options;
const riskAssesssmentQuestionFormSection: FormSectionState = {
title: title,
id: questionId ? `${id}${questionId}` : `${id}${index}`,
id: questionId ? `${id}${questionId}` : `${id}_${index}`,
isVisible: true,
fields: [
{
Expand Down
3 changes: 0 additions & 3 deletions src/webapp/pages/form-page/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ export function useForm(formType: FormType, id?: Id): State {
const currentEventTracker = getCurrentEventTracker();

useEffect(() => {
// if (currentEventTracker?.id && currentEventTrackerState?.id === currentEventTracker?.id)
// return;

compositionRoot.getWithOptions.execute(formType, currentEventTracker, id).run(
formData => {
setConfigurableForm(formData);
Expand Down

0 comments on commit 8a23e17

Please sign in to comment.