[refactoring] more record syntax refactoring

parent cf6fbff6
...@@ -74,18 +74,18 @@ addToAnnuaireWithForm :: FlowCmdM env err m ...@@ -74,18 +74,18 @@ addToAnnuaireWithForm :: FlowCmdM env err m
-> AnnuaireWithForm -> AnnuaireWithForm
-> (JobLog -> m ()) -> (JobLog -> m ())
-> m JobLog -> m JobLog
addToAnnuaireWithForm _cid (AnnuaireWithForm ft _d _l) logStatus = do addToAnnuaireWithForm _cid (AnnuaireWithForm { _wf_filetype }) logStatus = do
printDebug "ft" ft printDebug "ft" _wf_filetype
logStatus JobLog { _scst_succeeded = Just 1 logStatus JobLog { _scst_succeeded = Just 1
, _scst_failed = Just 0 , _scst_failed = Just 0
, _scst_remaining = Just 1 , _scst_remaining = Just 1
, _scst_events = Just [] , _scst_events = Just []
} }
pure JobLog { _scst_succeeded = Just 2 pure JobLog { _scst_succeeded = Just 2
, _scst_failed = Just 0 , _scst_failed = Just 0
, _scst_remaining = Just 0 , _scst_remaining = Just 0
, _scst_events = Just [] , _scst_events = Just []
} }
...@@ -63,15 +63,17 @@ getCorpus cId lId nt' = do ...@@ -63,15 +63,17 @@ getCorpus cId lId nt' = do
repo <- getRepo' [fromMaybe (panic "[Gargantext.API.Node.Corpus.Export]") lId] repo <- getRepo' [fromMaybe (panic "[Gargantext.API.Node.Corpus.Export]") lId]
ngs <- getNodeNgrams cId lId nt repo ngs <- getNodeNgrams cId lId nt repo
let -- uniqId is hash computed already for each document imported in database let -- uniqId is hash computed already for each document imported in database
r = Map.intersectionWith (\a b -> Document a (Ngrams (Set.toList b) (hash b)) (d_hash a b) r = Map.intersectionWith
) ns (Map.map (Set.map unNgramsTerm) ngs) (\a b -> Document { _d_document = a
, _d_ngrams = Ngrams (Set.toList b) (hash b)
, _d_hash = d_hash a b }
) ns (Map.map (Set.map unNgramsTerm) ngs)
where where
d_hash a b = hash [ fromMaybe "" (_hd_uniqId $ _node_hyperdata a) d_hash a b = hash [ fromMaybe "" (_hd_uniqId $ _node_hyperdata a)
, hash b , hash b
] ]
pure $ Corpus (Map.elems r) (hash $ List.map _d_hash pure $ Corpus { _c_corpus = Map.elems r
$ Map.elems r , _c_hash = hash $ List.map _d_hash $ Map.elems r }
)
getNodeNgrams :: HasNodeError err getNodeNgrams :: HasNodeError err
=> CorpusId => CorpusId
......
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