aboutsummaryrefslogtreecommitdiffstats
path: root/app/History/Issues.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-25 14:57:48 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-25 14:59:41 +0100
commitf70a60b85019766ee0a1cb61fa06c342b48f5172 (patch)
treeee834fe6cab041842ab784fb9031bc2772b1c277 /app/History/Issues.hs
parent4221ec60341d5d9e282d9a5e14ae19c132e5cf41 (diff)
fix: fix first scramble having to scan all files
Diffstat (limited to 'app/History/Issues.hs')
-rw-r--r--app/History/Issues.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/History/Issues.hs b/app/History/Issues.hs
index 1af0084..09f51dd 100644
--- a/app/History/Issues.hs
+++ b/app/History/Issues.hs
@@ -6,6 +6,7 @@ where
import Backend qualified
import Data.Binary (Binary)
import Data.Function (on)
+import Data.List (nub)
import Data.Map qualified as M
import Data.Proxy (Proxy)
import Data.Text qualified as T
@@ -16,7 +17,8 @@ import Issue qualified as I
data Issues = Issues
{ commitHash :: Backend.CommitHash,
- issues :: M.Map T.Text I.Issue
+ issues :: M.Map T.Text I.Issue,
+ filesSeen :: [FilePath]
}
deriving (Show, Generic, Binary)
@@ -27,7 +29,7 @@ instance Planable Issues where
protoOf _ = getScramble
assume :: Scramble -> Issues
- assume (Scramble {..}) = Issues {..}
+ assume (Scramble {..}) = Issues {filesSeen = filesChanged, ..}
propagate :: [Id Issues] -> Issues -> Scramble -> Issues
propagate _ topIssues bottomScramble =
@@ -51,9 +53,14 @@ instance Planable Issues where
(\topIssues -> topIssues)
( \bottomIssues ->
M.map
- (\bottomIssue -> bottomIssue {I.closed = True})
+ ( \bottomIssue ->
+ if bottomIssue.file `elem` topIssues.filesSeen
+ then bottomIssue {I.closed = True}
+ else bottomIssue
+ )
bottomIssues
)
topIssues.issues
- bottomScramble.issues
+ bottomScramble.issues,
+ filesSeen = nub (topIssues.filesSeen ++ bottomScramble.filesChanged)
}