diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-03-25 14:23:33 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-25 14:41:47 +0100 |
commit | 69f0021518a93db9fef11b45a464457eb9890ac5 (patch) | |
tree | d7bf38cbddd5da31ea577e5c61df8e9c88e184c4 /app/History/Scramble.hs | |
parent | 4a77e429e371bae4ab50551c7d382c6bd0af2eae (diff) |
fix: fix determine closed issues
Diffstat (limited to 'app/History/Scramble.hs')
-rw-r--r-- | app/History/Scramble.hs | 25 |
1 files changed, 25 insertions, 0 deletions
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 = |