Commit 2afb0b16 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Database] NodeNgramsNgrams minor change.

parent 4f736fc9
...@@ -124,8 +124,10 @@ data Action = Del | Add ...@@ -124,8 +124,10 @@ data Action = Del | Add
type NgramsParent = Text type NgramsParent = Text
type NgramsChild = Text type NgramsChild = Text
ngramsGroup :: Action -> [(ListId, NgramsParent, NgramsChild, Maybe Double)] ngramsGroup :: Action -> [(ListId, NgramsParent, NgramsChild, Maybe Double)]
-> Cmd err [Int] -> Cmd err [Int]
ngramsGroup _ [] = pure []
ngramsGroup action ngs = runNodeNgramsNgrams q ngs ngramsGroup action ngs = runNodeNgramsNgrams q ngs
where where
q = case action of q = case action of
...@@ -133,7 +135,7 @@ ngramsGroup action ngs = runNodeNgramsNgrams q ngs ...@@ -133,7 +135,7 @@ ngramsGroup action ngs = runNodeNgramsNgrams q ngs
Add -> queryInsertNodeNgramsNgrams Add -> queryInsertNodeNgramsNgrams
runNodeNgramsNgrams :: PGS.Query -> [(Int, NgramsParent, NgramsChild, Maybe Double)] -> Cmd err [Int] runNodeNgramsNgrams :: PGS.Query -> [(ListId, NgramsParent, NgramsChild, Maybe Double)] -> Cmd err [Int]
runNodeNgramsNgrams q ngs = map (\(PGS.Only a) -> a) <$> runPGSQuery q (PGS.Only $ Values fields ngs' ) runNodeNgramsNgrams q ngs = map (\(PGS.Only a) -> a) <$> runPGSQuery q (PGS.Only $ Values fields ngs' )
where where
ngs' = map (\(n,ng1,ng2,w) -> (n,ng1,ng2,maybe 0 identity w)) ngs ngs' = map (\(n,ng1,ng2,w) -> (n,ng1,ng2,maybe 0 identity w)) ngs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment