diff --git a/src/Gargantext/Viz/Graph.hs b/src/Gargantext/Viz/Graph.hs index da5497345f89fa1542901e1471c59995c46ae442..04753afd94939001dde6c747269c28fb4a1a253e 100644 --- a/src/Gargantext/Viz/Graph.hs +++ b/src/Gargantext/Viz/Graph.hs @@ -100,7 +100,7 @@ data GraphMetadata = GraphMetadata { _gm_title :: Text -- title of the grap , _gm_corpusId :: [NodeId] -- we can map with different corpus , _gm_legend :: [LegendField] -- legend of the Graph , _gm_list :: ListForGraph - , _gm_version :: Int + -- , _gm_version :: Int } deriving (Show, Generic) $(deriveJSON (unPrefix "_gm_") ''GraphMetadata) diff --git a/src/Gargantext/Viz/Graph/API.hs b/src/Gargantext/Viz/Graph/API.hs index bd4640970ccd6962bb5e8ed4f11842f965bc270f..66eeeea215591c70b7302e02bff1c1cd98e6132f 100644 --- a/src/Gargantext/Viz/Graph/API.hs +++ b/src/Gargantext/Viz/Graph/API.hs @@ -65,10 +65,11 @@ getGraph :: UserId -> NodeId -> GargServer (Get '[JSON] Graph) getGraph uId nId = do nodeGraph <- getNodeWith nId HyperdataGraph let graph = nodeGraph ^. node_hyperdata . hyperdataGraph - let graphVersion = graph ^? _Just + let listVersion = graph ^? _Just . graph_metadata . _Just - . gm_version + . gm_list + . lfg_version v <- currentVersion nodeUser <- getNodeWith (NodeId uId) HyperdataUser @@ -85,7 +86,7 @@ getGraph uId nId = do _ <- insertGraph cId uId' (HyperdataGraph $ Just graph') pure graph' - Just graph' -> if graphVersion == Just v + Just graph' -> if listVersion == Just v then pure graph' else do graph'' <- computeGraph cId NgramsTerms v @@ -98,14 +99,12 @@ getGraph uId nId = do computeGraph :: CorpusId -> NgramsType -> Int -> GargServer (Get '[JSON] Graph) computeGraph cId nt v = do lId <- defaultList cId - v' <- currentVersion let metadata = GraphMetadata "Title" [cId] [ LegendField 1 "#FFF" "Cluster" , LegendField 2 "#FFF" "Cluster" ] - (ListForGraph lId v') - v + (ListForGraph lId v) -- (map (\n -> LegendField n "#FFFFFF" (pack $ show n)) [1..10]) lIds <- selectNodesWithUsername NodeList userMaster