Skip to content

Commit

Permalink
Fix: #2316 - same name shown twice in autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Roach committed Mar 19, 2019
1 parent 55dc282 commit bc870f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/Individual.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public static function rowMapper(): Closure
$individual = Individual::getInstance($row->i_id, Tree::findById((int) $row->i_file), $row->i_gedcom);

if ($row->n_num ?? null) {
$individual = clone $individual;
$individual->setPrimaryName($row->n_num);

return $individual;
}

return $individual;
Expand Down
4 changes: 2 additions & 2 deletions app/Services/SearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ public function searchIndividualNames(array $trees, array $search, int $offset =
->on('name.n_id', '=', 'individuals.i_id');
})
->orderBy('n_sort')
->select(['individuals.*', 'n_sort', 'n_num'])
->distinct();
->select(['individuals.*', 'n_num']);

$this->whereTrees($query, 'i_file', $trees);
$this->whereSearch($query, 'n_full', $search);
Expand Down Expand Up @@ -875,6 +874,7 @@ private function paginateQuery(Builder $query, Closure $row_mapper, Closure $row
}
}


return $collection;
}

Expand Down

0 comments on commit bc870f7

Please sign in to comment.