Compare commits
1 Commits
774d5acbd2
...
d5f94845e8
| Author | SHA1 | Date | |
|---|---|---|---|
| d5f94845e8 |
@@ -32,7 +32,16 @@ func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate flo
|
||||
is = append(is, iss...)
|
||||
}
|
||||
|
||||
is = filter(is, config.IssueFilter)
|
||||
{
|
||||
issueURLs := make([]string, 0, len(is))
|
||||
for _, issue := range is {
|
||||
issueURLs = append(issueURLs, issue.HTMLURL)
|
||||
}
|
||||
s.log.Debug("loaded all issues", "issueURLs", issueURLs)
|
||||
}
|
||||
|
||||
is = s.filterIssues(is, config.IssueFilter)
|
||||
|
||||
issues := issue.FromGiteas(is, config.Mindur)
|
||||
r = report.New(
|
||||
issues,
|
||||
@@ -53,12 +62,14 @@ func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate flo
|
||||
return document, r, err
|
||||
}
|
||||
|
||||
func filter[T any](slice []T, ok func(T) bool) []T {
|
||||
out := make([]T, 0, len(slice))
|
||||
func (s *Service) filterIssues(slice []*gitea.Issue, ok func(*gitea.Issue) bool) []*gitea.Issue {
|
||||
out := make([]*gitea.Issue, 0, len(slice))
|
||||
|
||||
for _, item := range slice {
|
||||
if ok(item) {
|
||||
out = append(out, item)
|
||||
for _, issue := range slice {
|
||||
if ok(issue) {
|
||||
out = append(out, issue)
|
||||
} else {
|
||||
s.log.Debug("filter out issue", "issueURL", issue.HTMLURL)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user