From 695115ba4a911419b31cdadc0b159f82e2e19744 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Mon, 6 Nov 2023 10:16:41 +0545 Subject: [PATCH] fix (createNewProject): splitTasks - number of tasks and map updated when options changed to choose_area_as_task --- .../src/components/createnewproject/SplitTasks.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/createnewproject/SplitTasks.tsx b/src/frontend/src/components/createnewproject/SplitTasks.tsx index dfc98588e3..c2bc7843e7 100644 --- a/src/frontend/src/components/createnewproject/SplitTasks.tsx +++ b/src/frontend/src/components/createnewproject/SplitTasks.tsx @@ -112,6 +112,12 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo dispatch(CreateProjectActions.SetIndividualProjectDetailsData({ ...projectDetails, ...formValues })); }; + useEffect(() => { + if (splitTasksSelection === 'choose_area_as_task') { + dispatch(CreateProjectActions.SetDividedTaskGeojson(null)); + } + }, [splitTasksSelection]); + const { handleSubmit, handleCustomChange, @@ -228,7 +234,7 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo )); }; - const parsedTaskGeojsonCount = dividedTaskGeojson?.features?.length || drawnGeojson?.features?.length; + const parsedTaskGeojsonCount = dividedTaskGeojson?.features?.length || drawnGeojson?.features?.length || 1; const totalSteps = dividedTaskGeojson?.features ? dividedTaskGeojson?.features?.length : parsedTaskGeojsonCount; return ( <> @@ -299,7 +305,7 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo )} )} - {formValues.splitTaskOption === 'task_splitting_algorithm' && ( + {splitTasksSelection === 'task_splitting_algorithm' && ( <>

Average number of buildings per task: