Commit d232ce36 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Code Design

parent b7a25acc
...@@ -583,43 +583,42 @@ triggerSearch { onSearch, errors, session, selection, search } = ...@@ -583,43 +583,42 @@ triggerSearch { onSearch, errors, session, selection, search } =
searchQuery :: ListSelection.Selection -> Search -> SearchQuery searchQuery :: ListSelection.Selection -> Search -> SearchQuery
searchQuery selection { datafield: Nothing, term } = searchQuery selection { datafield: Nothing, term } =
over SearchQuery (_ { query = term over SearchQuery (_ { query = term
, selection = selection }) defaultSearchQuery , selection = selection }) defaultSearchQuery
-- TODO Simplify both HAL Nothing and HAL (Just IMT) cases -- TODO Simplify both HAL Nothing and HAL (Just IMT) cases
searchQuery selection { databases searchQuery selection { databases
, datafield: datafield@(Just (External (Just (HAL Nothing)))) , datafield: datafield@(Just (External (Just (HAL Nothing))))
, lang , lang
, term , term
, node_id , node_id
, years } = , years } = over SearchQuery (_ { databases = databases
over SearchQuery (_ { databases = databases , datafield = datafield
, datafield = datafield , lang = lang
, lang = lang , node_id = node_id
, node_id = node_id , query = queryHAL term Nothing lang years
, query = queryHAL term Nothing lang years , selection = selection
, selection = selection }) defaultSearchQuery
}) defaultSearchQuery
searchQuery selection { databases searchQuery selection { databases
, datafield: datafield@(Just (External (Just (HAL (Just (IMT imtOrgs)))))) , datafield: datafield@(Just (External (Just (HAL (Just (IMT imtOrgs))))))
, lang , lang
, term , term
, node_id , node_id
, years } = , years } = over SearchQuery (_ { databases = databases
over SearchQuery (_ { databases = databases , datafield = datafield
, datafield = datafield , lang = lang
, lang = lang , node_id = node_id
, node_id = node_id , query = queryHAL term (Just imtOrgs) lang years
, query = queryHAL term (Just imtOrgs) lang years , selection = selection
, selection = selection }) defaultSearchQuery
}) defaultSearchQuery
searchQuery selection { databases, datafield, lang, term, node_id } = searchQuery selection { databases, datafield, lang, term, node_id } =
over SearchQuery (_ { databases = databases over SearchQuery (_ { databases = databases
, datafield = datafield , datafield = datafield
, lang = lang , lang = lang
, node_id = node_id , node_id = node_id
, query = term , query = term
, selection = selection , selection = selection
}) defaultSearchQuery }) defaultSearchQuery
queryHAL :: String -> Maybe (Set.Set IMT_org) -> Maybe Lang -> Array String -> String queryHAL :: String -> Maybe (Set.Set IMT_org) -> Maybe Lang -> Array String -> String
queryHAL term mIMTOrgs lang years = queryHAL term mIMTOrgs lang years =
......
...@@ -280,7 +280,7 @@ defaultSearchQuery = SearchQuery ...@@ -280,7 +280,7 @@ defaultSearchQuery = SearchQuery
, node_id : Nothing , node_id : Nothing
, offset : Nothing , offset : Nothing
, order : Nothing , order : Nothing
, selection : ListSelection.MyListsFirst , selection : ListSelection.NoList -- MyListsFirst
} }
performSearch :: Session -> Int -> SearchQuery -> AffRESTError GT.AsyncTaskWithType performSearch :: Session -> Int -> SearchQuery -> AffRESTError GT.AsyncTaskWithType
......
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