Fix scoring sort

title-higher-score-in-search-code-ape
Jérémy Rialland 2023-03-14 18:52:04 +01:00 committed by Jérémy Rialland
parent 2a36746ef6
commit 836ff04cf2
1 changed files with 2 additions and 1 deletions

View File

@ -145,7 +145,8 @@ export default function SearchCodeAPE({ disabled }: SearchCodeApeProps) {
.map((item, index, arr) => ({
item,
scoreFuzzy: index / arr.length,
nbEtablissement: lazyData.indexByCodeApe[item.codeApe.replace('.', '')],
nbEtablissement:
lazyData.indexByCodeApe[item.codeApe.replace('.', '')] || 0,
}))
.sort(({ nbEtablissement: a }, { nbEtablissement: b }) => b - a)
.map(({ item, scoreFuzzy, nbEtablissement }, index, arr) => {