app: Trie les suggestions par importance

This commit is contained in:
Mattéo Delabre 2019-12-04 20:50:11 -05:00
parent 0df46ac942
commit 1767738167
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
2 changed files with 5 additions and 4 deletions

View File

@ -186,7 +186,10 @@ const TermInput = ({terms, availableTerms, setTerms}) =>
{suggestion.alias.length >= 1 ? ( {suggestion.alias.length >= 1 ? (
<span <span
className="TermInput_suggestionAlias" className="TermInput_suggestionAlias"
title={`Alias du terme: ${suggestion.alias.join(', ')}`} title={
'Alias du terme: '
+ suggestion.alias.join(', ')
}
> >
{suggestion.alias.join(', ')} {suggestion.alias.join(', ')}
</span> </span>

View File

@ -65,8 +65,6 @@ export const filterTerms = (search, terms) =>
// Normalisation des mots recherchés // Normalisation des mots recherchés
const needle = normalizeName(search); const needle = normalizeName(search);
console.log(needle);
return terms.filter(term => return terms.filter(term =>
{ {
// Normalisation du nom et des alias du terme // Normalisation du nom et des alias du terme
@ -79,5 +77,5 @@ export const filterTerms = (search, terms) =>
word.startsWith(item) word.startsWith(item)
) )
); );
}); }).sort((term1, term2) => term2.weight - term1.weight);
}; };