Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt dataExplorer export for intervention_start_date #2251

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: adapt dataExplorer export for intervention_start_date
mohitb35 committed Oct 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 5604885088dca55df7fce3ac23e4ae91e401e3f2
2 changes: 1 addition & 1 deletion public/static/locales/en/treemapperAnalytics.json
Original file line number Diff line number Diff line change
@@ -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",
2 changes: 1 addition & 1 deletion src/features/common/types/dataExplorer.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;