aboutsummaryrefslogtreecommitdiffstats
path: root/app/History/IssueEvents.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/History/IssueEvents.hs')
-rw-r--r--app/History/IssueEvents.hs26
1 files changed, 18 insertions, 8 deletions
diff --git a/app/History/IssueEvents.hs b/app/History/IssueEvents.hs
index 3fca32a..fc5feff 100644
--- a/app/History/IssueEvents.hs
+++ b/app/History/IssueEvents.hs
@@ -21,7 +21,8 @@ import IssueEvent qualified as E
data IssueEvents = IssueEvents
{ commitHash :: Backend.CommitHash,
- issueEvents :: [E.IssueEvent]
+ issueEvents :: [E.IssueEvent],
+ filesSeen :: [FilePath]
}
deriving (Show, Generic, Binary)
@@ -38,6 +39,7 @@ instance Planable IssueEvents where
[ IssueCreated commitHash issue
| issue <- M.elems issues
],
+ filesSeen = filesChanged,
..
}
@@ -129,17 +131,27 @@ 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 {closed = True},
- IssueCreated bottomCommitHash bottomIssue
- ]
+ ( if bottomIssue.file `elem` topIssueEvents.filesSeen
+ then
+ [ IssueDeleted topIssueEvents.commitHash bottomIssue {closed = True},
+ IssueCreated bottomCommitHash bottomIssue
+ ]
+ else
+ [ IssueCreated bottomCommitHash bottomIssue
+ ]
+ )
| bottomIssue <- bottomIssues,
all ((`nsym` bottomIssue) . issue . NE.last) issueEventsPerIssue
]
- ]
+ ],
+ filesSeen = nub (topIssueEvents.filesSeen ++ bottomScramble.filesChanged)
}
where
groupPerIssue =
- map (NE.sortBy (comparing logOrder)) . NE.groupBy (sym `on` issue) . sortOn ((.id) . issue)
+ map (NE.sortBy (comparing logOrder))
+ . NE.groupBy (sym `on` issue)
+ . sortOn ((.id) . issue)
+ logOrder = fromMaybe (-1) . (`elemIndex` log) . commitHash
topCommitHash = topIssueEvents.commitHash
bottomCommitHash = bottomScramble.commitHash
@@ -158,5 +170,3 @@ propagateIssueEvents log topIssueEvents bottomScramble =
issue (IssueChanged _ _ issue) = issue
issue (IssueCreated _ issue) = issue
issue (IssueDeleted _ issue) = issue
-
- logOrder = fromMaybe (-1) . (`elemIndex` log) . commitHash