Skip to content

Commit

Permalink
Merge pull request #819 from hotosm/feat-projectlist-map
Browse files Browse the repository at this point in the history
feat: data extract custom
  • Loading branch information
varun2948 authored Sep 10, 2023
2 parents c064166 + 9b97657 commit fab9515
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
12 changes: 9 additions & 3 deletions src/frontend/main/src/api/CreateProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,21 @@ const GetIndividualProjectDetails: Function = (url: string, payload: any) => {
};
};

const TaskSplittingPreviewService: Function = (url: string, fileUpload: any, no_of_buildings: string) => {
const TaskSplittingPreviewService: Function = (
url: string,
fileUpload: any,
no_of_buildings: string,
isCustomDataExtract: boolean,
) => {
return async (dispatch) => {
dispatch(CreateProjectActions.GetTaskSplittingPreviewLoading(true));

const getTaskSplittingGeojson = async (url, fileUpload) => {
const getTaskSplittingGeojson = async (url, fileUpload, isCustomDataExtract) => {
try {
const taskSplittingFileFormData = new FormData();
taskSplittingFileFormData.append('upload', fileUpload);
taskSplittingFileFormData.append('no_of_buildings', no_of_buildings);
taskSplittingFileFormData.append('has_data_extracts', isCustomDataExtract);

const getTaskSplittingResponse = await axios.post(url, taskSplittingFileFormData);
const resp: OrganisationListModel = getTaskSplittingResponse.data;
Expand All @@ -344,7 +350,7 @@ const TaskSplittingPreviewService: Function = (url: string, fileUpload: any, no_
}
};

await getTaskSplittingGeojson(url, fileUpload);
await getTaskSplittingGeojson(url, fileUpload, isCustomDataExtract);
};
};
const PatchProjectDetails: Function = (url: string, payload: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const DefineTasks: React.FC<any> = ({ geojsonFile, setGeojsonFile, dataExtractFi
`${enviroment.baseApiUrl}/projects/task_split`,
drawnGeojsonFile,
formValues?.no_of_buildings,
dataExtractFile ? true : false,
),
);
} else {
Expand All @@ -96,6 +97,7 @@ const DefineTasks: React.FC<any> = ({ geojsonFile, setGeojsonFile, dataExtractFi
`${enviroment.baseApiUrl}/projects/task_split`,
geojsonFile,
formValues?.no_of_buildings,
dataExtractFile ? true : false,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ const UpdateProjectArea = ({ projectId }) => {
};
}, [uploadAOI]);

useEffect(() => {
if (!outline_geojson) return;
setGeojsonAOI(outline_geojson);
if (!dividedTaskGeojson) return;
setGeojsonAOI(dividedTaskGeojson);
}, [dividedTaskGeojson, outline_geojson]);
// useEffect(() => {
// if (!outline_geojson) return;
// setGeojsonAOI(outline_geojson);
// if (!dividedTaskGeojson) return;
// setGeojsonAOI(dividedTaskGeojson);
// }, [dividedTaskGeojson, outline_geojson]);

const generateTasksOnMap = () => {
dispatch(
Expand Down

0 comments on commit fab9515

Please sign in to comment.