aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue/Group.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-04 08:36:02 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-05 06:07:41 +0100
commit1b1c3faabae530229eb675a2e70e744c2f45cbbe (patch)
treeacc3e8eede9053fb5e639deeb553aa600c994598 /app/Issue/Group.hs
parent3a76b6f0fc0c9c23000dd82870922c885c34ffa6 (diff)
feat: add experimental render api
Diffstat (limited to 'app/Issue/Group.hs')
-rw-r--r--app/Issue/Group.hs16
1 files changed, 4 insertions, 12 deletions
diff --git a/app/Issue/Group.hs b/app/Issue/Group.hs
index 69caf20..2f19a98 100644
--- a/app/Issue/Group.hs
+++ b/app/Issue/Group.hs
@@ -1,15 +1,13 @@
module Issue.Group
( groupArg,
- groupIssuesBy,
+ groupIssuesByTag,
)
where
import Data.Map (Map)
import Data.Map qualified as M
-import Data.Maybe (mapMaybe)
import Data.Text qualified as T
import Issue (Issue (..))
-import Issue.Tag (Tag (..))
import Issue.Tag qualified as I
import Options.Applicative qualified as O
@@ -28,20 +26,14 @@ groupArg =
| "@" `T.isPrefixOf` s = Just (T.drop 1 s)
| otherwise = Nothing
-groupIssuesBy :: T.Text -> [Issue] -> Map T.Text [Issue]
-groupIssuesBy group issues =
+groupIssuesByTag :: T.Text -> [Issue] -> Map T.Text [Issue]
+groupIssuesByTag tagKey issues =
foldl
( \collected issue ->
foldl
(flip $ M.alter (Just . maybe [issue] (issue :)))
collected
- (groupsOfIssue group issue)
+ (I.tagValuesOf tagKey (issue.tags ++ issue.internalTags))
)
M.empty
issues
-
-groupsOfIssue :: T.Text -> Issue -> [T.Text]
-groupsOfIssue group issue =
- mapMaybe I.tagValue
- . filter (\(Tag key _) -> key == group)
- $ issue.tags ++ issue.internalTags