Skip to content

Commit

Permalink
fix (createNewProject): splitTasks - number of tasks and map updated …
Browse files Browse the repository at this point in the history
…when options changed to choose_area_as_task (#967)
  • Loading branch information
NSUWAL123 authored Nov 6, 2023
1 parent 0acbf1f commit f252b35
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/frontend/src/components/createnewproject/SplitTasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 (
<>
Expand Down Expand Up @@ -299,7 +305,7 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customLineUpload, custo
)}
</>
)}
{formValues.splitTaskOption === 'task_splitting_algorithm' && (
{splitTasksSelection === 'task_splitting_algorithm' && (
<>
<div className="fmtm-mt-6 fmtm-flex fmtm-items-center fmtm-gap-4">
<p className="fmtm-text-gray-500">Average number of buildings per task: </p>
Expand Down

0 comments on commit f252b35

Please sign in to comment.