Commits

Konstantine Rybnikov committed 94e7d18

Add filtering index by current path

Comments (0)

Files changed (1)

Duplicates/Duplicates.hs

 getDuplicatesCount :: NodesIndex -> FilePath -> Integer
 getDuplicatesCount index folder = do
   let infos = getInfosInsideFolder index folder
-      counts = filter (>0) $ map (getDuplicatesCountByInfo index) infos
+      indexFiltered = index @= (NodeFolder $ folder)
+      counts = filter (>0) $ map (getDuplicatesCountByInfo indexFiltered) infos
     in toInteger $ length counts
 
 getInfosInsideFolder :: NodesIndex -> FilePath -> [NodeInfo]
 getDuplicatesCountByInfo :: NodesIndex -> NodeInfo -> Integer
 getDuplicatesCountByInfo index info =
   toInteger $ (size similarItems) - 1
-  where similarItems = (index @= (getChecksum info))
-                       &&& (index @= (getSize info))
+  where similarItems =
+          (index @= (getChecksum info))
+          &&& (index @= (getSize info))
 
 printIndex :: NodesIndex -> IO ()
 printIndex index = do