Skip to content

Commit

Permalink
[TM-1603] avoid duplicated taxon_id in initial list (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarLima1 authored Jan 23, 2025
1 parent c8fc578 commit 6d39aab
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ private function handleTreeSpecies(Request $request, EntityModel $entity): JsonR
if ($filter = $request->query('filter')) {
if (! empty($filter['collection'])) {
$query->where('collection', $filter['collection']);
$entityTreeSpecies = $query->get();

$entityTreeSpecies = $query->get()->groupBy('taxon_id')->map(function ($group) {
return $group->first();
})->values();
$transformer = new TreeSpeciesTransformer($entity, $entityTreeSpecies, $filter['collection']);
$transformedData = $transformer->transform();

Expand Down

0 comments on commit 6d39aab

Please sign in to comment.