From cbc1f91f349abec27f1e459336b6c822c5add728 Mon Sep 17 00:00:00 2001 From: Rafael Solorzano <61289255+rafasdc@users.noreply.github.com> Date: Mon, 28 Oct 2024 10:30:39 -0700 Subject: [PATCH] fix: calculate non indigenous and communities from template 9 --- app/lib/helpers/ccbcSummaryGenerateFormData.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/lib/helpers/ccbcSummaryGenerateFormData.tsx b/app/lib/helpers/ccbcSummaryGenerateFormData.tsx index 660391e27f..e10242bdd8 100644 --- a/app/lib/helpers/ccbcSummaryGenerateFormData.tsx +++ b/app/lib/helpers/ccbcSummaryGenerateFormData.tsx @@ -391,13 +391,18 @@ const getFormDataFromApplication = ( formData: { counts: { communities: - (applicationData?.applicationFormTemplate9DataByApplicationId - ?.nodes[0]?.jsonData?.communitiesToBeServed || 0) + - (applicationData?.applicationFormTemplate9DataByApplicationId - ?.nodes[0]?.jsonData?.indigenousCommunitiesToBeServed || 0), - nonIndigenousCommunities: applicationData?.applicationFormTemplate9DataByApplicationId?.nodes[0] ?.jsonData?.communitiesToBeServed, + nonIndigenousCommunities: + applicationData?.applicationFormTemplate9DataByApplicationId?.nodes[0] + ?.jsonData?.communitiesToBeServed && + applicationData?.applicationFormTemplate9DataByApplicationId?.nodes[0] + ?.jsonData?.indigenousCommunitiesToBeServed + ? (applicationData?.applicationFormTemplate9DataByApplicationId + ?.nodes[0]?.jsonData?.communitiesToBeServed || 0) - + (applicationData?.applicationFormTemplate9DataByApplicationId + ?.nodes[0]?.jsonData?.indigenousCommunitiesToBeServed || 0) + : null, indigenousCommunities: applicationData?.applicationFormTemplate9DataByApplicationId?.nodes[0] ?.jsonData?.indigenousCommunitiesToBeServed,