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
141
Issues
141
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
a0c61ebe
Commit
a0c61ebe
authored
Dec 10, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] User History of patches, ok
parent
9b35cefd
Pipeline
#1288
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
11 deletions
+27
-11
Types.hs
src/Gargantext/API/Ngrams/Types.hs
+1
-1
History.hs
src/Gargantext/Core/Text/List/Social/History.hs
+26
-10
No files found.
src/Gargantext/API/Ngrams/Types.hs
View file @
a0c61ebe
...
...
@@ -644,7 +644,7 @@ data Repo s p = Repo
,
_r_history
::
!
[
p
]
-- first patch in the list is the most recent
}
deriving
(
Generic
)
deriving
(
Generic
,
Show
)
instance
(
FromJSON
s
,
FromJSON
p
)
=>
FromJSON
(
Repo
s
p
)
where
parseJSON
=
genericParseJSON
$
unPrefix
"_r_"
...
...
src/Gargantext/Core/Text/List/Social/History.hs
View file @
a0c61ebe
...
...
@@ -11,7 +11,6 @@ Portability : POSIX
module
Gargantext.Core.Text.List.Social.History
where
import
Data.Maybe
(
catMaybes
)
import
Data.Map
(
Map
)
import
Control.Lens
(
view
)
import
Gargantext.API.Ngrams.Types
...
...
@@ -23,22 +22,39 @@ import qualified Data.List as List
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
userHistory
::
[
NgramsType
]
->
[
ListId
]
->
Repo
s
NgramsStatePatch
->
Map
NgramsType
(
Map
ListId
[
Map
NgramsTerm
NgramsPatch
])
userHistory
t
l
r
=
clean
$
history
t
l
r
where
clean
=
Map
.
map
(
Map
.
map
List
.
init
)
history
::
(
Foldable
t
,
Foldable
h
)
=>
t
NgramsType
->
h
ListId
history
::
[
NgramsType
]
->
[
ListId
]
->
Repo
s
NgramsStatePatch
->
Map
NgramsType
(
Map
ListId
[
Map
NgramsTerm
NgramsPatch
])
history
types
lists
=
Map
.
unionsWith
(
<>
)
.
map
(
Map
.
map
(
Map
.
map
cons
))
.
map
(
Map
.
map
((
Map
.
filterWithKey
(
\
k
_
->
List
.
elem
k
lists
))))
.
map
(
Map
.
filterWithKey
(
\
k
_
->
List
.
elem
k
types
))
.
map
toMap
.
view
r_history
history
types
lists
=
merge
.
map
(
Map
.
map
(
Map
.
map
cons
))
.
map
(
Map
.
map
((
Map
.
filterWithKey
(
\
k
_
->
List
.
elem
k
lists
))))
.
map
(
Map
.
filterWithKey
(
\
k
_
->
List
.
elem
k
types
))
.
map
toMap
.
view
r_history
where
cons
a
=
[
a
]
merge
::
[
Map
NgramsType
(
Map
ListId
[
Map
NgramsTerm
NgramsPatch
])]
->
Map
NgramsType
(
Map
ListId
[
Map
NgramsTerm
NgramsPatch
])
merge
=
Map
.
unionsWith
merge'
where
merge'
::
Map
ListId
[
Map
NgramsTerm
NgramsPatch
]
->
Map
ListId
[
Map
NgramsTerm
NgramsPatch
]
->
Map
ListId
[
Map
NgramsTerm
NgramsPatch
]
merge'
=
Map
.
unionWith
(
<>
)
toMap
::
PatchMap
NgramsType
(
PatchMap
NodeId
(
NgramsTablePatch
...
...
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