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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
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
6f1e7414
Commit
6f1e7414
authored
Mar 05, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] post list now set new list as list (and remove previous one).
parent
3d9e9804
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+28
-2
List.hs
src/Gargantext/API/Ngrams/List.hs
+1
-1
No files found.
src/Gargantext/API/Ngrams.hs
View file @
6f1e7414
...
...
@@ -39,6 +39,8 @@ module Gargantext.API.Ngrams
,
TableNgramsApiPost
,
getTableNgrams
,
setListNgrams
,
rmListNgrams
,
putListNgrams
,
putListNgrams'
,
tableNgramsPost
...
...
@@ -116,7 +118,7 @@ import Data.Map.Strict (Map)
import
qualified
Data.Set
as
Set
import
Control.Category
((
>>>
))
import
Control.Concurrent
import
Control.Lens
(
makeLenses
,
makePrisms
,
Getter
,
Iso
'
,
iso
,
from
,
(
.~
),
(
?=
),
(
#
),
to
,
folded
,
{-withIndex, ifolded,-}
view
,
use
,
(
^.
),
(
^..
),
(
^?
),
(
+~
),
(
%~
),
(
%=
),
sumOf
,
at
,
_Just
,
Each
(
..
),
itraverse_
,
both
,
forOf_
,
(
%%~
),
(
?~
),
mapped
)
import
Control.Lens
(
makeLenses
,
makePrisms
,
Getter
,
Iso
'
,
iso
,
from
,
(
.~
),
(
?=
),
(
#
),
to
,
folded
,
{-withIndex, ifolded,-}
view
,
use
,
(
^.
),
(
^..
),
(
^?
),
(
+~
),
(
%~
),
(
.~
),
(
%=
),
sumOf
,
at
,
_Just
,
Each
(
..
),
itraverse_
,
both
,
forOf_
,
(
%%~
),
(
?~
),
mapped
)
import
Control.Monad.Error.Class
(
MonadError
)
import
Control.Monad.Reader
import
Control.Monad.State
...
...
@@ -673,7 +675,7 @@ instance Arbitrary a => Arbitrary (Versioned a) where
{-
-- TODO sequencs of modifications (Patchs)
-- TODO sequenc
e
s of modifications (Patchs)
type NgramsIdPatch = Patch NgramsId NgramsPatch
ngramsPatch :: Int -> NgramsPatch
...
...
@@ -854,6 +856,30 @@ addListNgrams listId ngramsType nes = do
m = Map.fromList $ (\n -> (n ^. ne_ngrams, n)) <$> nes
-}
rmListNgrams
::
RepoCmdM
env
err
m
=>
ListId
->
NgramsType
->
m
()
rmListNgrams
l
nt
=
setListNgrams
l
nt
mempty
setListNgrams
::
RepoCmdM
env
err
m
=>
NodeId
->
NgramsType
->
Map
NgramsTerm
NgramsRepoElement
->
m
()
setListNgrams
listId
ngramsType
ns
=
do
var
<-
view
repoVar
liftIO
$
modifyMVar_
var
$
pure
.
(
r_state
.
at
ngramsType
%~
(
Just
.
(
at
listId
.~
(
Just
ns
))
.
something
)
)
saveRepo
-- If the given list of ngrams elements contains ngrams already in
-- the repo, they will be ignored.
putListNgrams
::
RepoCmdM
env
err
m
...
...
src/Gargantext/API/Ngrams/List.hs
View file @
6f1e7414
...
...
@@ -95,7 +95,7 @@ post :: FlowCmdM env err m
->
m
Bool
post
l
m
=
do
-- TODO check with Version for optim
_
<-
mapM
(
\
(
nt
,
Versioned
_v
ns
)
->
putListNgrams'
l
nt
ns
)
$
toList
m
_
<-
mapM
(
\
(
nt
,
Versioned
_v
ns
)
->
setListNgrams
l
nt
ns
)
$
toList
m
-- TODO reindex
pure
True
...
...
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