Commit 2051c952 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/544-dev-term-table-suggestion-fix-for-children' into dev

parents 7f7ac4ad d0dad1e4
...@@ -518,8 +518,10 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where ...@@ -518,8 +518,10 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
rows :: PreConversionRows rows :: PreConversionRows
rows = ngramsTableOrderWith orderBy (Seq.mapMaybe rowMap nres) rows = ngramsTableOrderWith orderBy (Seq.mapMaybe rowMap nres)
nres = Map.toUnfoldable (ngramsTable ^. _NgramsTable <<< _ngrams_repo_elements) nres = Map.toUnfoldable (ngramsTable ^. _NgramsTable <<< _ngrams_repo_elements)
ngramMatches matcher ng nre =
any matcher $ (Set.map ngramsTermText $ Set.insert ng $ nre ^. _NgramsRepoElement <<< _children)
rootOfMatch (Tuple ng nre) = rootOfMatch (Tuple ng nre) =
if queryMatchesLabel searchQuery (ngramsTermText ng) if ngramMatches (queryMatchesLabel searchQuery) ng nre
then Just (fromMaybe ng (nre ^. _NgramsRepoElement <<< _root)) then Just (fromMaybe ng (nre ^. _NgramsRepoElement <<< _root))
else Nothing else Nothing
rootsWithMatches = Set.fromFoldable (Seq.mapMaybe rootOfMatch nres) rootsWithMatches = Set.fromFoldable (Seq.mapMaybe rootOfMatch nres)
...@@ -529,8 +531,7 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where ...@@ -529,8 +531,7 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
-- | Match either ngrams term or its children with the -- | Match either ngrams term or its children with the
-- | `queryExactMatchesLabel` function. -- | `queryExactMatchesLabel` function.
fltr :: Tuple NgramsTerm NgramsRepoElement -> Boolean fltr :: Tuple NgramsTerm NgramsRepoElement -> Boolean
fltr (Tuple ng (NgramsRepoElement { children })) = fltr (Tuple ng nre) = ngramMatches (queryExactMatchesLabel searchQuery) ng nre
any (queryExactMatchesLabel searchQuery) $ (Set.map ngramsTermText $ Set.insert ng children)
rowsFilter :: NgramsElement -> Maybe NgramsElement rowsFilter :: NgramsElement -> Maybe NgramsElement
rowsFilter ngramsElement = rowsFilter ngramsElement =
if displayRow { ngramsElement if displayRow { ngramsElement
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment