Commit 77283dfc authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FLOW] default master CorpusId fix.

parent 53633abe
...@@ -301,7 +301,7 @@ getTableNgrams c cId maybeTabType maybeListId = do ...@@ -301,7 +301,7 @@ getTableNgrams c cId maybeTabType maybeListId = do
(ngramsTableDatas, mapToParent, mapToChildren) <- (ngramsTableDatas, mapToParent, mapToChildren) <-
Ngrams.getNgramsTableDb c NodeDocument ngramsType (Ngrams.NgramsTableParam listId cId) Ngrams.getNgramsTableDb c NodeDocument ngramsType (Ngrams.NgramsTableParam listId cId)
printDebug "ngramsTableDatas" ngramsTableDatas -- printDebug "ngramsTableDatas" ngramsTableDatas
pure $ NgramsTable $ map (\(Ngrams.NgramsTableData ngs _ lt w) -> pure $ NgramsTable $ map (\(Ngrams.NgramsTableData ngs _ lt w) ->
NgramsElement ngs NgramsElement ngs
......
...@@ -28,7 +28,7 @@ import Gargantext.Core.Types (NodePoly(..), ListType(..), listTypeId) ...@@ -28,7 +28,7 @@ import Gargantext.Core.Types (NodePoly(..), ListType(..), listTypeId)
import Gargantext.Database.Bashql (runCmd') -- , del) import Gargantext.Database.Bashql (runCmd') -- , del)
import Gargantext.Database.Config (userMaster, userArbitrary, corpusMasterName) import Gargantext.Database.Config (userMaster, userArbitrary, corpusMasterName)
import Gargantext.Database.Ngrams (insertNgrams, Ngrams(..), NgramsT(..), NgramsIndexed(..), indexNgramsT, NgramsType(..), text2ngrams) import Gargantext.Database.Ngrams (insertNgrams, Ngrams(..), NgramsT(..), NgramsIndexed(..), indexNgramsT, NgramsType(..), text2ngrams)
import Gargantext.Database.Node (mkRoot, mkCorpus, Cmd(..), mkList, mkGraph, mkDashboard, mkAnnuaire)--, getCorporaWithParentId') import Gargantext.Database.Node (mkRoot, mkCorpus, Cmd(..), mkList, mkGraph, mkDashboard, mkAnnuaire, getCorporaWithParentId')
import Gargantext.Database.Root (getRootCmd) import Gargantext.Database.Root (getRootCmd)
import Gargantext.Database.Types.Node (NodeType(..), NodeId) import Gargantext.Database.Types.Node (NodeType(..), NodeId)
import Gargantext.Database.Node.Document.Add (add) import Gargantext.Database.Node.Document.Add (add)
...@@ -146,17 +146,18 @@ subFlowCorpus username cName = do ...@@ -146,17 +146,18 @@ subFlowCorpus username cName = do
True -> panic "Error: more than 1 userNode / user" True -> panic "Error: more than 1 userNode / user"
False -> pure rootId' False -> pure rootId'
let rootId = maybe (panic "error rootId") identity (head rootId'') let rootId = maybe (panic "error rootId") identity (head rootId'')
{- --{-
corpusId'' <- if username == userMaster corpusId'' <- if username == userMaster
then runCmd' $ getCorporaWithParentId' rootId then do
else pure [] ns <- runCmd' $ getCorporaWithParentId' rootId
pure $ map _node_id ns
else
pure []
let corpusId''' = case map _node_id <$> head corpusId'' of
Nothing ->
-- panic "error" -- pure Nothing
-- else (view node_id <$> head <$> runCmd' $ getCorporaWithParentId' rootId)
--} --}
corpusId' <- runCmd' $ mkCorpus (Just cName) Nothing rootId userId corpusId' <- if corpusId'' /= []
then pure corpusId''
else runCmd' $ mkCorpus (Just cName) Nothing rootId userId
let corpusId = maybe (panic "error corpusId") identity (head corpusId') let corpusId = maybe (panic "error corpusId") identity (head 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