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
199
Issues
199
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
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,
...
@@ -749,29 +749,42 @@ tableNgramsPatch :: (HasNgramError err, HasInvalidError err,
=>
CorpusId
->
Maybe
TabType
->
ListId
=>
CorpusId
->
Maybe
TabType
->
ListId
->
Versioned
NgramsTablePatch
->
Versioned
NgramsTablePatch
->
m
(
Versioned
NgramsTablePatch
)
->
m
(
Versioned
NgramsTablePatch
)
tableNgramsPatch
_corpusId
maybeTabType
listId
(
Versioned
p_version
p_table
)
=
do
tableNgramsPatch
_corpusId
maybeTabType
listId
(
Versioned
p_version
p_table
)
let
ngramsType
=
ngramsTypeFromTabType
maybeTabType
|
p_table
==
mempty
=
do
(
p0
,
p0_validity
)
=
PM
.
singleton
listId
p_table
let
ngramsType
=
ngramsTypeFromTabType
maybeTabType
(
p
,
p_validity
)
=
PM
.
singleton
ngramsType
p0
var
<-
view
repoVar
assertValid
p0_validity
r
<-
liftIO
$
readMVar
var
assertValid
p_validity
let
var
<-
view
repoVar
q
=
mconcat
$
take
(
r
^.
r_version
-
p_version
)
(
r
^.
r_history
)
vq'
<-
liftIO
$
modifyMVar
var
$
\
r
->
do
q_table
=
q
^.
_PatchMap
.
at
ngramsType
.
_Just
.
_PatchMap
.
at
listId
.
_Just
let
q
=
mconcat
$
take
(
r
^.
r_version
-
p_version
)
(
r
^.
r_history
)
pure
(
Versioned
(
r
^.
r_version
)
q_table
)
(
p'
,
q'
)
=
transformWith
ngramsStatePatchConflictResolution
p
q
r'
=
r
&
r_version
+~
1
|
otherwise
=
do
&
r_state
%~
act
p'
let
ngramsType
=
ngramsTypeFromTabType
maybeTabType
&
r_history
%~
(
p'
:
)
(
p0
,
p0_validity
)
=
PM
.
singleton
listId
p_table
q'_table
=
q'
^.
_PatchMap
.
at
ngramsType
.
_Just
.
_PatchMap
.
at
listId
.
_Just
(
p
,
p_validity
)
=
PM
.
singleton
ngramsType
p0
assertValid
$
transformable
p
q
assertValid
$
applicable
p'
(
r
^.
r_state
)
assertValid
p0_validity
pure
(
r'
,
Versioned
(
r'
^.
r_version
)
q'_table
)
assertValid
p_validity
saveRepo
var
<-
view
repoVar
pure
vq'
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
{- DB version
when (version /= 1) $ ngramError UnsupportedVersion
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