From 0b7b43d202d9c9a623c3c12d1e3b7a91f1fee9ed Mon Sep 17 00:00:00 2001 From: erinz Date: Tue, 24 Oct 2023 20:15:36 +0000 Subject: [PATCH 1/2] add some columns to sightings table --- locale/en.json | 4 ++- .../ElasticsearchSightingsDisplay.jsx | 33 +++++++++++++++---- .../sighting/useSightingSearchSchemas.js | 9 +++++ 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/locale/en.json b/locale/en.json index 2591e408..c18ff860 100644 --- a/locale/en.json +++ b/locale/en.json @@ -1268,5 +1268,7 @@ "IN_PROGRESS" : "In progress", "UNPROCESSED" : "Unprocessed", "NO_MATCH_DESCRIPTION" : "Can't find any match for the sighting?", - "CONFIRM_NO_MATCH" : "Confirm no match" + "CONFIRM_NO_MATCH" : "Confirm no match", + "NUMBER_OF_INDIVIDUALS" : "Number of individuals", + "NUMBER_OF_ENCOUNTERS" : "Number of encounters" } diff --git a/src/components/dataDisplays/ElasticsearchSightingsDisplay.jsx b/src/components/dataDisplays/ElasticsearchSightingsDisplay.jsx index 98bea22e..f01f1658 100644 --- a/src/components/dataDisplays/ElasticsearchSightingsDisplay.jsx +++ b/src/components/dataDisplays/ElasticsearchSightingsDisplay.jsx @@ -14,8 +14,8 @@ export default function ElasticsearchSightingsDisplay({ ...rest }) { const title = `${dataCount || sightings.length} matching sightings`; - - const tableData = sightings.map(sighting => { + + const tableData = sightings.map(sighting => // const encounters = sighting?.encounters || []; // const photoCount = encounters.reduce((memo, e) => { // memo += e.images.length; @@ -27,12 +27,12 @@ export default function ElasticsearchSightingsDisplay({ // return individual ? [...memo, individual] : null; // }, []); - return { + ({ ...sighting, // photoCount, // individuals, - }; - }); + }), + ); const columns = [ { @@ -50,6 +50,24 @@ export default function ElasticsearchSightingsDisplay({ sortable: true, align: 'left', }, + { + name: 'numberIndividuals', + labelId: 'NUMBER_OF_INDIVIDUALS', + sortable: false, + align: 'left', + }, + { + name: 'numberEncounters', + labelId: 'NUMBER_OF_ENCOUNTERS', + sortable: false, + align: 'left', + }, + { + name: 'verbatimLocality', + labelId: 'FREEFORM_LOCATION', + sortable: false, + align: 'left', + }, { name: 'owners', sortName: 'owners.full_name', @@ -58,6 +76,7 @@ export default function ElasticsearchSightingsDisplay({ align: 'left', options: { customBodyRender: owners => { + // eslint-disable-line const ownerName = get( owners, [0, 'full_name'], @@ -81,7 +100,9 @@ export default function ElasticsearchSightingsDisplay({ labelId: 'ACTIONS', sortable: false, options: { - customBodyRender: guid => ( + customBodyRender: ( + guid, // eslint-disable-line + ) => ( Date: Tue, 24 Oct 2023 20:36:06 +0000 Subject: [PATCH 2/2] change to number of animals --- locale/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/en.json b/locale/en.json index c18ff860..7ebf05ff 100644 --- a/locale/en.json +++ b/locale/en.json @@ -1270,5 +1270,5 @@ "NO_MATCH_DESCRIPTION" : "Can't find any match for the sighting?", "CONFIRM_NO_MATCH" : "Confirm no match", "NUMBER_OF_INDIVIDUALS" : "Number of individuals", - "NUMBER_OF_ENCOUNTERS" : "Number of encounters" + "NUMBER_OF_ENCOUNTERS" : "Number of animals" }