From 91e188fbb70c20b939c221a95123934358d1c6c5 Mon Sep 17 00:00:00 2001 From: Fabian Kirchner Date: Wed, 29 Nov 2023 14:14:33 +0100 Subject: feat: collect issues referencing issue --- app/Issue/Meta.hs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 app/Issue/Meta.hs (limited to 'app/Issue/Meta.hs') diff --git a/app/Issue/Meta.hs b/app/Issue/Meta.hs new file mode 100644 index 0000000..d9851ec --- /dev/null +++ b/app/Issue/Meta.hs @@ -0,0 +1,27 @@ +module Issue.Meta + ( Meta (..), + getMeta, + ) +where + +import Data.Text qualified as T +import Issue (Issue (..)) +import Issue.Tag (Tag, tagValue) + +data Meta = Meta + { referencedBy :: [(Issue, Tag)] + } + deriving (Show) + +getMeta :: [Issue] -> Issue -> Meta +getMeta issues issue = + Meta + { referencedBy = + concatMap + ( \issueOther -> + let tagsRelevant = + filter (\tag -> tagValue tag == fmap T.pack issue.id) issueOther.tags + in map (\tag -> (issue, tag)) tagsRelevant + ) + issues + } -- cgit v1.2.3