From 69f0021518a93db9fef11b45a464457eb9890ac5 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Mon, 25 Mar 2024 14:23:33 +0100 Subject: fix: fix determine closed issues --- app/History/Scramble.hs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'app/History/Scramble.hs') diff --git a/app/History/Scramble.hs b/app/History/Scramble.hs index 39a1ac7..093db98 100644 --- a/app/History/Scramble.hs +++ b/app/History/Scramble.hs @@ -1,5 +1,6 @@ module History.Scramble ( Scramble (..), + getScramble, getIssuesOfFile, fromComment, ) @@ -34,6 +35,30 @@ data Scramble = Scramble } deriving (Show, Binary, Generic) +getScramble :: Backend.CommitHash -> IO Scramble +getScramble commitHash@Backend.WorkingTree = do + filesChanged <- Backend.getFilesOf commitHash + issues <- concat <$> mapM (getIssuesOfFile commitHash) filesChanged + pure $ + Scramble + { issues = + M.unions + [ M.singleton issue.id issue | issue <- issues + ], + .. + } +getScramble commitHash@(Backend.Commit _) = do + filesChanged <- Backend.getChangedFilesOf commitHash + issues <- concat <$> mapM (getIssuesOfFile commitHash) filesChanged + pure $ + Scramble + { issues = + M.unions + [ M.singleton issue.id issue | issue <- issues + ], + .. + } + -- | Get all issues in the given directory and file. getIssuesOfFile :: Backend.CommitHash -> FilePath -> IO [I.Issue] getIssuesOfFile commitHash filename = -- cgit v1.2.3