diff options
Diffstat (limited to 'app/History/Issues.hs')
-rw-r--r-- | app/History/Issues.hs | 15 |
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) } |