Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
162
Issues
162
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
ec9906ef
Commit
ec9906ef
authored
Mar 20, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BIN] import quick arg to create new users.
parent
d556ab83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Main.hs
bin/gargantext-import/Main.hs
+5
-3
Flow.hs
src/Gargantext/Database/Flow.hs
+3
-3
No files found.
bin/gargantext-import/Main.hs
View file @
ec9906ef
...
...
@@ -38,7 +38,7 @@ import Control.Monad.IO.Class (liftIO)
main
::
IO
()
main
=
do
[
user
,
iniPath
,
name
,
corpusPath
]
<-
getArgs
[
user
,
iniPath
,
name
,
corpusPath
,
users
]
<-
getArgs
--{-
let
createUsers
::
Cmd
ServantErr
Int64
...
...
@@ -49,7 +49,7 @@ main = do
--}
let
cmdCorpus
::
forall
m
.
FlowCmdM
DevEnv
ServantErr
m
=>
m
[
CorpusId
]
cmdCorpus
=
do
docs
<-
liftIO
(
splitEvery
30
00
<$>
readFile
corpusPath
::
IO
[[
GrandDebatReference
]])
docs
<-
liftIO
(
splitEvery
5
00
<$>
readFile
corpusPath
::
IO
[[
GrandDebatReference
]])
ids
<-
flowCorpus''
(
Text
.
pack
user
)
(
Text
.
pack
name
)
(
Mono
FR
)
docs
pure
ids
...
...
@@ -57,7 +57,9 @@ main = do
env
<-
newDevEnvWith
iniPath
-- Better if we keep only one call to runCmdDev.
_
<-
runCmdDev
env
createUsers
_
<-
if
users
==
"0"
then
runCmdDev
env
createUsers
else
pure
1
_
<-
runCmdDev
env
cmdCorpus
pure
()
...
...
src/Gargantext/Database/Flow.hs
View file @
ec9906ef
...
...
@@ -104,7 +104,7 @@ flowCorpusSearchInDatabase u q = do
-- TODO uniformize language of corpus
flowCorpusMaster
::
FlowCmdM
env
ServantErr
m
=>
TermType
Lang
->
[
HyperdataDocument
]
->
m
[
NodeId
]
flowCorpusMaster
la
hd
=
(
insertMasterDocs
la
)
$
(
map
addUniqIdsDoc
)
hd
flowCorpusMaster
la
hd
=
insertMasterDocs
la
hd
flowCorpusUser
::
FlowCmdM
env
ServantErr
m
=>
Username
->
CorpusName
->
[
NodeId
]
->
m
CorpusId
...
...
@@ -134,8 +134,8 @@ flowCorpusUser userName corpusName ids = do
insertMasterDocs
::
FlowCmdM
env
ServantErr
m
=>
TermType
Lang
->
[
HyperdataDocument
]
->
m
[
DocId
]
insertMasterDocs
lang
hs
=
do
let
hyperdataDocuments'
=
map
(
\
h
->
ToDbDocument
h
)
hs
let
hs'
=
map
addUniqIdsDoc
hs
let
hyperdataDocuments'
=
map
(
\
h
->
ToDbDocument
h
)
hs
'
(
masterUserId
,
_
,
masterCorpusId
)
<-
getOrMkRootWithCorpus
userMaster
corpusMasterName
ids
<-
insertDocuments
masterUserId
masterCorpusId
NodeDocument
hyperdataDocuments'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment