Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
fix a encounter issue
Browse files Browse the repository at this point in the history
  • Loading branch information
erinz authored and erinz committed Sep 20, 2023
1 parent 9897dfc commit d379031
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/components/dataDisplays/ElasticsearchSightingsDisplay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,24 @@ export default function ElasticsearchSightingsDisplay({
...rest
}) {
const title = `${dataCount || sightings.length} matching sightings`;
console.log('sightings', sightings);

const tableData = sightings.map(sighting => {
const encounters = sighting?.encounters || [];
const photoCount = encounters.reduce((memo, e) => {
memo += e.images.length;
return memo;
}, 0);
// const encounters = sighting?.encounters || [];
// const photoCount = encounters.reduce((memo, e) => {
// memo += e.images.length;
// return memo;
// }, 0);

const individuals = encounters.reduce((memo, e) => {
const individual = get(e, 'individual.id', null);
return individual ? [...memo, individual] : null;
}, []);
// const individuals = encounters.reduce((memo, e) => {
// const individual = get(e, 'individual.id', null);
// return individual ? [...memo, individual] : null;
// }, []);

return {
...sighting,
photoCount,
individuals,
// photoCount,
// individuals,
};
});

Expand Down

0 comments on commit d379031

Please sign in to comment.