diff options
Diffstat (limited to 'app/History/IssueEvents.hs')
-rw-r--r-- | app/History/IssueEvents.hs | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/app/History/IssueEvents.hs b/app/History/IssueEvents.hs index fc7bdcf..3fca32a 100644 --- a/app/History/IssueEvents.hs +++ b/app/History/IssueEvents.hs @@ -14,7 +14,7 @@ import Data.Ord (comparing) import Data.Proxy (Proxy) import GHC.Generics (Generic) import History.Plan (Id, Planable, Proto, assume, propagate, protoOf) -import History.Scramble (Scramble (..), getIssuesOfFile) +import History.Scramble (Scramble (..), getScramble) import Issue (Issue (..)) import IssueEvent (IssueEvent (..)) import IssueEvent qualified as E @@ -29,28 +29,7 @@ instance Planable IssueEvents where type Id IssueEvents = Backend.CommitHash type Proto IssueEvents = Scramble protoOf :: Proxy IssueEvents -> Backend.CommitHash -> IO Scramble - protoOf _ 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 - ], - .. - } - protoOf _ 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 - ], - .. - } + protoOf _ = getScramble assume :: Scramble -> IssueEvents assume Scramble {..} = @@ -112,7 +91,7 @@ propagateIssueEvents log topIssueEvents bottomScramble = if commitHash /= topCommitHash then [ IssueCreated commitHash issue, - IssueDeleted topCommitHash issue, + IssueDeleted topCommitHash issue {closed = True}, IssueCreated bottomCommitHash bottomIssue ] else @@ -150,7 +129,7 @@ propagateIssueEvents log topIssueEvents bottomScramble = ], concat [ -- CASE 4. The issue it not present in the top/earlier history, but contained in the bottom scramble. It had to be deleted by the top/ earlier commit. - [ IssueDeleted topIssueEvents.commitHash bottomIssue, + [ IssueDeleted topIssueEvents.commitHash bottomIssue {closed = True}, IssueCreated bottomCommitHash bottomIssue ] | bottomIssue <- bottomIssues, |