From c0a2cf6116352a346e54ab63bd95aa64313aee0b Mon Sep 17 00:00:00 2001 From: Steve Cassidy Date: Tue, 24 Sep 2024 20:50:17 +1000 Subject: [PATCH] Fix CSV export lat/long, add created date, accuracy Signed-off-by: Steve Cassidy --- src/couchdb/notebooks.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/couchdb/notebooks.ts b/src/couchdb/notebooks.ts index 93e0e699..275fe00f 100644 --- a/src/couchdb/notebooks.ts +++ b/src/couchdb/notebooks.ts @@ -623,12 +623,14 @@ const csvFormatValue = ( if (fieldType === 'faims-pos::Location') { if (value instanceof Object && 'geometry' in value) { result[fieldName] = value; - result[fieldName + '_latitude'] = value.geometry.coordinates[0]; - result[fieldName + '_longitude'] = value.geometry.coordinates[1]; + result[fieldName + '_latitude'] = value.geometry.coordinates[1]; + result[fieldName + '_longitude'] = value.geometry.coordinates[0]; + result[fieldName + '_accuracy'] = value.properties.accuracy || ''; } else { result[fieldName] = value; result[fieldName + '_latitude'] = ''; result[fieldName + '_longitude'] = ''; + result[fieldName + '_accuracy'] = ''; } return result; } @@ -740,6 +742,8 @@ export const streamNotebookRecordsAsCSV = async ( record.record_id, record.revision_id, record.type, + record.created_by, + record.created.toISOString(), record.updated_by, record.updated.toISOString(), ]; @@ -759,6 +763,8 @@ export const streamNotebookRecordsAsCSV = async ( 'record_id', 'revision_id', 'type', + 'created_by', + 'created', 'updated_by', 'updated', ];