Skip to content

Commit

Permalink
fix: show coordinate
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikmv committed Nov 29, 2024
1 parent 194c20c commit dba3800
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/core_modules/capture-core/converters/serverToClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ export function convertOptionSetValue(value: any, type: $Keys<typeof dataElement
}

function convertCoordinateToClient(value: any) {
if (typeof value === 'string') {
const coordinates = value.replace(/[()]/g, '').split(',').map(Number);
return { latitude: coordinates[1], longitude: coordinates[0] };
}
return { latitude: value[1], longitude: value[0] };
const coordinates = typeof value === 'string' ?
value.replace(/[\(\)\[\]\s]/g, '').split(',').map(Number) : value;

return { latitude: coordinates[1], longitude: coordinates[0] };
}

function convertPolygonToClient(value: any) {
Expand Down

0 comments on commit dba3800

Please sign in to comment.