Skip to content

Commit

Permalink
Fix downloaded facility table coordinates.
Browse files Browse the repository at this point in the history
  • Loading branch information
ccxzhang committed Nov 9, 2024
1 parent a0ef36e commit 3dd743f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/renderer/src/pages/Facility/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,13 @@ const FacilityTable = () => {

const handleExportToCSV = () => {
const csvData = facilities.map((item) => {
// Flatten the data as needed
const flatItem = {
Level: item.level,
Name: item.displayName,
ID: item.id,
Coordinates: formatGeometrySummary(item.geometry),
Coordinates: item.geometry
? JSON.stringify(item.geometry.coordinates)
: 'No geometry available',
'Organization Unit Groups': item.organisationUnitGroups
? item.organisationUnitGroups.map((group) => group.name).join(', ')
: 'N/A'
Expand All @@ -162,6 +163,7 @@ const FacilityTable = () => {

return flatItem
})

const csv = Papa.unparse(csvData)
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' })
const url = URL.createObjectURL(blob)
Expand Down

0 comments on commit 3dd743f

Please sign in to comment.