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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Christian Merten
haskell-gargantext
Commits
a08eff3a
Unverified
Commit
a08eff3a
authored
Feb 28, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NGRAMS-REPO]: special case for "pull"
parent
193c1ba1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
23 deletions
+36
-23
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+36
-23
No files found.
src/Gargantext/API/Ngrams.hs
View file @
a08eff3a
...
...
@@ -749,29 +749,42 @@ tableNgramsPatch :: (HasNgramError err, HasInvalidError err,
=>
CorpusId
->
Maybe
TabType
->
ListId
->
Versioned
NgramsTablePatch
->
m
(
Versioned
NgramsTablePatch
)
tableNgramsPatch
_corpusId
maybeTabType
listId
(
Versioned
p_version
p_table
)
=
do
let
ngramsType
=
ngramsTypeFromTabType
maybeTabType
(
p0
,
p0_validity
)
=
PM
.
singleton
listId
p_table
(
p
,
p_validity
)
=
PM
.
singleton
ngramsType
p0
assertValid
p0_validity
assertValid
p_validity
var
<-
view
repoVar
vq'
<-
liftIO
$
modifyMVar
var
$
\
r
->
do
let
q
=
mconcat
$
take
(
r
^.
r_version
-
p_version
)
(
r
^.
r_history
)
(
p'
,
q'
)
=
transformWith
ngramsStatePatchConflictResolution
p
q
r'
=
r
&
r_version
+~
1
&
r_state
%~
act
p'
&
r_history
%~
(
p'
:
)
q'_table
=
q'
^.
_PatchMap
.
at
ngramsType
.
_Just
.
_PatchMap
.
at
listId
.
_Just
assertValid
$
transformable
p
q
assertValid
$
applicable
p'
(
r
^.
r_state
)
pure
(
r'
,
Versioned
(
r'
^.
r_version
)
q'_table
)
saveRepo
pure
vq'
tableNgramsPatch
_corpusId
maybeTabType
listId
(
Versioned
p_version
p_table
)
|
p_table
==
mempty
=
do
let
ngramsType
=
ngramsTypeFromTabType
maybeTabType
var
<-
view
repoVar
r
<-
liftIO
$
readMVar
var
let
q
=
mconcat
$
take
(
r
^.
r_version
-
p_version
)
(
r
^.
r_history
)
q_table
=
q
^.
_PatchMap
.
at
ngramsType
.
_Just
.
_PatchMap
.
at
listId
.
_Just
pure
(
Versioned
(
r
^.
r_version
)
q_table
)
|
otherwise
=
do
let
ngramsType
=
ngramsTypeFromTabType
maybeTabType
(
p0
,
p0_validity
)
=
PM
.
singleton
listId
p_table
(
p
,
p_validity
)
=
PM
.
singleton
ngramsType
p0
assertValid
p0_validity
assertValid
p_validity
var
<-
view
repoVar
vq'
<-
liftIO
$
modifyMVar
var
$
\
r
->
do
let
q
=
mconcat
$
take
(
r
^.
r_version
-
p_version
)
(
r
^.
r_history
)
(
p'
,
q'
)
=
transformWith
ngramsStatePatchConflictResolution
p
q
r'
=
r
&
r_version
+~
1
&
r_state
%~
act
p'
&
r_history
%~
(
p'
:
)
q'_table
=
q'
^.
_PatchMap
.
at
ngramsType
.
_Just
.
_PatchMap
.
at
listId
.
_Just
assertValid
$
transformable
p
q
assertValid
$
applicable
p'
(
r
^.
r_state
)
pure
(
r'
,
Versioned
(
r'
^.
r_version
)
q'_table
)
saveRepo
pure
vq'
{- DB version
when (version /= 1) $ ngramError UnsupportedVersion
...
...
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