From 5604885088dca55df7fce3ac23e4ae91e401e3f2 Mon Sep 17 00:00:00 2001 From: mohitb35 <44917347+mohitb35@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:40:20 +0530 Subject: [PATCH 1/2] feat: adapt dataExplorer export for intervention_start_date --- public/static/locales/en/treemapperAnalytics.json | 2 +- src/features/common/types/dataExplorer.d.ts | 2 +- .../user/TreeMapper/Analytics/components/Export/index.tsx | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/static/locales/en/treemapperAnalytics.json b/public/static/locales/en/treemapperAnalytics.json index 8d7d41d9ea..bb2d5abd10 100644 --- a/public/static/locales/en/treemapperAnalytics.json +++ b/public/static/locales/en/treemapperAnalytics.json @@ -28,7 +28,7 @@ "dec": "Dec", "exportColumnHeaders": { "hid": "Human Readable ID for a plant location", - "plantDate": "Planted Date", + "interventionStartDate": "Starting date of intervention (e.g. Tree planting date)", "species": "Name of the species planted", "treeCount": "", "geometry": "GeoJson Co-ordinate of the polygon", diff --git a/src/features/common/types/dataExplorer.d.ts b/src/features/common/types/dataExplorer.d.ts index f0e18e9240..96c914f24c 100644 --- a/src/features/common/types/dataExplorer.d.ts +++ b/src/features/common/types/dataExplorer.d.ts @@ -34,7 +34,7 @@ export interface ISpeciesPlanted { export interface IExportData { hid: string; - plant_date: Date; + intervention_start_date: Date; species: string; tree_count: number; geometry: string; diff --git a/src/features/user/TreeMapper/Analytics/components/Export/index.tsx b/src/features/user/TreeMapper/Analytics/components/Export/index.tsx index 2d26301cfb..70d5667a95 100644 --- a/src/features/user/TreeMapper/Analytics/components/Export/index.tsx +++ b/src/features/user/TreeMapper/Analytics/components/Export/index.tsx @@ -78,8 +78,8 @@ export const Export = () => { description: t('exportColumnHeaders.hid'), }, { - title: 'plant_date', - description: t('exportColumnHeaders.plantDate'), + title: 'intervention_start_date', + description: t('exportColumnHeaders.interventionStartDate'), }, { title: 'species', @@ -142,6 +142,7 @@ export const Export = () => { }; const extractDataToXlsx = (data: IExportData[]) => { + console.log('Data for export:', data[0]); const worksheet = utils.json_to_sheet(data); const workbook = utils.book_new(); @@ -173,6 +174,7 @@ export const Export = () => { const handleExport = async () => { if (localProject) { const res = await makeRequest(); + console.log('Data received from API:', res?.data[0]); if (res) { const { data } = res; From bc8d1d1781ddc14b6e1bc48b2f8058563b449449 Mon Sep 17 00:00:00 2001 From: mohitb35 <44917347+mohitb35@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:15:57 +0530 Subject: [PATCH 2/2] feat: deprecate plantDate from `PlantLocationBase` type --- src/features/common/types/plantLocation.d.ts | 1 - .../PlantLocation/PlantLocationDetails.tsx | 4 +++- .../components/maps/PlantLocations.tsx | 4 +++- .../Import/components/ReviewSubmit.tsx | 16 +++++++++------- .../user/TreeMapper/components/Map.tsx | 18 ------------------ .../components/PlantLocationPage.tsx | 12 ++++++++---- 6 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/features/common/types/plantLocation.d.ts b/src/features/common/types/plantLocation.d.ts index 529b50d57b..b82693b0c0 100644 --- a/src/features/common/types/plantLocation.d.ts +++ b/src/features/common/types/plantLocation.d.ts @@ -11,7 +11,6 @@ export interface PlantLocationBase { registrationDate: DateString; /** @deprecated */ plantDate: DateString; - interventionDate: DateString; interventionStartDate: DateString | null; //should be the same as interventionDate interventionEndDate: DateString | null; lastMeasurementDate: DateString | null; diff --git a/src/features/projects/components/PlantLocation/PlantLocationDetails.tsx b/src/features/projects/components/PlantLocation/PlantLocationDetails.tsx index dd781f6e19..0c2a2773c2 100644 --- a/src/features/projects/components/PlantLocation/PlantLocationDetails.tsx +++ b/src/features/projects/components/PlantLocation/PlantLocationDetails.tsx @@ -207,7 +207,9 @@ export default function PlantLocationDetails({
{tTreemapper('plantDate')}
-{tTreemapper('plantDate')}
+{tTreemapper('registrationDate')}