diff --git a/src/Gargantext/Prelude.hs b/src/Gargantext/Prelude.hs index 3b17e3a6215ab3a66553bd064960629f7116b75c..820054044eafb0ef22935468155fc4dce8747e5d 100644 --- a/src/Gargantext/Prelude.hs +++ b/src/Gargantext/Prelude.hs @@ -124,8 +124,11 @@ type Grain = Int type Step = Int -- | Function to split a range into chunks +-- if step == grain then linearity +-- elif step < grain then overlapping +-- else dotted with holes chunkAlong :: Eq a => Grain -> Step -> [a] -> [[a]] -chunkAlong a b l = case a > 0 && b > 0 && a >= b of +chunkAlong a b l = case a > 0 && b > 0 of True -> chunkAlong_ a b l False -> panic "ChunkAlong: Parameters should be > 0 and Grain > Step" diff --git a/src/Gargantext/Viz/Phylo/Example.hs b/src/Gargantext/Viz/Phylo/Example.hs index f1522bd22b14417604b28ff7b81cc6e4f4638a37..b79c0ea82ce3d67c2b05afb07d4eac8657001242 100644 --- a/src/Gargantext/Viz/Phylo/Example.hs +++ b/src/Gargantext/Viz/Phylo/Example.hs @@ -59,9 +59,9 @@ phyloTerms = toPeriodes date 5 3 $ cleanHistory mapList phyloCorpus toPeriodes :: (Ord date, Enum date) => (event -> date) -> Grain -> Step -> [event] -> Map (date, date) [event] toPeriodes _ _ _ [] = panic "Empty history can not have any periods" -toPeriodes f s o as = DM.fromList $ zip hs $ map (inPeriode f as) hs +toPeriodes f g s es = DM.fromList $ zip hs $ map (inPeriode f es) hs where - hs = steps s o $ both f (DL.head as, DL.last as) + hs = steps g s $ both f (DL.head es, DL.last es) inPeriode :: Ord b => (t -> b) -> [t] -> (b, b) -> [t] inPeriode f h (start,end) =