Commit 1690d344 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] Social list over before integration to flow list

parent 05a7f4cc
...@@ -24,6 +24,7 @@ import Gargantext.Database.Query.Tree.Root (getRootId) ...@@ -24,6 +24,7 @@ import Gargantext.Database.Query.Tree.Root (getRootId)
import Gargantext.Prelude import Gargantext.Prelude
-- filterList imports -- filterList imports
import Data.Maybe (fromMaybe)
import Data.Map (Map) import Data.Map (Map)
import Data.Set (Set) import Data.Set (Set)
import Data.Text (Text) import Data.Text (Text)
...@@ -37,19 +38,39 @@ import qualified Data.Map as Map ...@@ -37,19 +38,39 @@ import qualified Data.Map as Map
import qualified Data.Set as Set import qualified Data.Set as Set
{-
flowSocialList :: ( RepoCmdM env err m flowSocialList :: ( RepoCmdM env err m
, CmdM env err m , CmdM env err m
, HasNodeError err , HasNodeError err
, HasTreeError err , HasTreeError err
) )
=> NodeMode -> User -> NgramsType -> Set Text => User -> NgramsType -> Set Text
-> m (Map (Maybe ListType) (Set Text)) -> m (Map ListType (Set Text))
flowSocialList mode user nt ngrams' = do flowSocialList user nt ngrams' = do
privateMapList <- flowSocialListByMode Private user nt ngrams' privateMapList <- flowSocialListByMode Private user nt ngrams'
sharedMapList <- flowSocialListByMode Shared user nt (fromMaybe Set.empty $ sharedMapList <- flowSocialListByMode Shared user nt (termsByList CandidateTerm privateMapList)
-- TODO publicMapList -- TODO publicMapList
-}
pure $ Map.fromList [ (MapTerm, termsByList MapTerm privateMapList
<> termsByList MapTerm sharedMapList
)
, (StopTerm, termsByList StopTerm privateMapList
<> termsByList StopTerm sharedMapList
)
, (CandidateTerm, termsByList CandidateTerm sharedMapList)
]
termsByList :: ListType -> (Map (Maybe ListType) (Set Text)) -> Set Text
termsByList CandidateTerm m =
fromMaybe Set.empty
$ (<>) <$> Map.lookup Nothing m
<*> Map.lookup (Just CandidateTerm) m
termsByList l m =
fromMaybe Set.empty $ Map.lookup (Just l) m
flowSocialListByMode :: ( RepoCmdM env err m flowSocialListByMode :: ( RepoCmdM env err m
, CmdM env err m , CmdM env err m
......
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