From f3eb580f055be5b4df837069f28b0e72ad3a28b3 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 3 May 2023 13:23:02 +0200 Subject: dashboard: move common bug filtering to createPatchTestingJobs --- dashboard/app/reporting.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'dashboard/app/reporting.go') diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go index 98d7e884a..f72caacba 100644 --- a/dashboard/app/reporting.go +++ b/dashboard/app/reporting.go @@ -683,6 +683,18 @@ func foreachBug(c context.Context, filter func(*db.Query) *db.Query, fn func(bug } } +func filterBugs(bugs []*Bug, keys []*db.Key, filter func(*Bug) bool) ([]*Bug, []*db.Key) { + var retBugs []*Bug + var retKeys []*db.Key + for i, bug := range bugs { + if filter(bug) { + retBugs = append(retBugs, bugs[i]) + retKeys = append(retKeys, keys[i]) + } + } + return retBugs, retKeys +} + // reportingPollClosed is called by backends to get list of closed bugs. func reportingPollClosed(c context.Context, ids []string) ([]string, error) { idMap := make(map[string]bool, len(ids)) -- cgit mrf-deployment