Commit 69695fe9 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[graph] fix default list id for graph

parent 5a8e197b
Pipeline #2141 failed with stage
in 10 minutes and 24 seconds
...@@ -90,10 +90,11 @@ getGraph _uId nId = do ...@@ -90,10 +90,11 @@ getGraph _uId nId = do
let let
graph = nodeGraph ^. node_hyperdata . hyperdataGraph graph = nodeGraph ^. node_hyperdata . hyperdataGraph
camera = nodeGraph ^. node_hyperdata . hyperdataCamera camera = nodeGraph ^. node_hyperdata . hyperdataCamera
cId = maybe (panic "[G.V.G.API] Node has no parent")
identity mcId <- getClosestParentIdByType nId NodeCorpus
$ nodeGraph ^. node_parent_id let cId = maybe (panic "[G.V.G.API] Node has no parent") identity mcId
printDebug "[getGraph] getting list for cId" cId
listId <- defaultList cId listId <- defaultList cId
repo <- getRepo' [listId] repo <- getRepo' [listId]
...@@ -130,15 +131,13 @@ recomputeGraph _uId nId maybeDistance = do ...@@ -130,15 +131,13 @@ recomputeGraph _uId nId maybeDistance = do
graphMetric = case maybeDistance of graphMetric = case maybeDistance of
Nothing -> graph ^? _Just . graph_metadata . _Just . gm_metric Nothing -> graph ^? _Just . graph_metadata . _Just . gm_metric
_ -> maybeDistance _ -> maybeDistance
let
cId = maybe (panic "[G.C.V.G.API.recomputeGraph] Node has no parent")
identity
$ nodeGraph ^. node_parent_id
similarity = case graphMetric of similarity = case graphMetric of
Nothing -> withMetric Order1 Nothing -> withMetric Order1
Just m -> withMetric m Just m -> withMetric m
mcId <- getClosestParentIdByType nId NodeCorpus
let cId = maybe (panic "[G.V.G.API] Node has no parent") identity mcId
listId <- defaultList cId listId <- defaultList cId
repo <- getRepo' [listId] repo <- getRepo' [listId]
let v = repo ^. unNodeStory . at listId . _Just . a_version let v = repo ^. unNodeStory . at listId . _Just . a_version
......
...@@ -386,7 +386,6 @@ defaultList cId = ...@@ -386,7 +386,6 @@ defaultList cId =
defaultListMaybe :: (HasNodeError err, HasDBid NodeType) => CorpusId -> Cmd err (Maybe NodeId) defaultListMaybe :: (HasNodeError err, HasDBid NodeType) => CorpusId -> Cmd err (Maybe NodeId)
defaultListMaybe cId = headMay <$> map (view node_id ) <$> getListsWithParentId cId defaultListMaybe cId = headMay <$> map (view node_id ) <$> getListsWithParentId cId
getListsWithParentId :: HasDBid NodeType => NodeId -> Cmd err [Node HyperdataList] getListsWithParentId :: HasDBid NodeType => NodeId -> Cmd err [Node HyperdataList]
getListsWithParentId n = runOpaQuery $ selectNodesWith' n (Just NodeList) getListsWithParentId n = runOpaQuery $ selectNodesWith' n (Just NodeList)
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