Commit e8a08b6e authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '258545-separate-trainee-maintainer-and-reviewer-in-reviewer-roulette' into 'master'

Separate trainee maintainer and reviewer in reviewer roulette

Closes #258545

See merge request gitlab-org/gitlab!43656
parents bea36800 d875a710
......@@ -147,6 +147,7 @@ module Gitlab
spin_role_for_category(team, role, project, category)
end
hungry_reviewers = reviewers.select { |member| member.hungry }
hungry_traintainers = traintainers.select { |member| member.hungry }
# TODO: take CODEOWNERS into account?
# https://gitlab.com/gitlab-org/gitlab/issues/26723
......@@ -156,7 +157,7 @@ module Gitlab
# Make hungry traintainers have 4x the chance to be picked as a reviewer
# Make traintainers have 3x the chance to be picked as a reviewer
# Make hungry reviewers have 2x the chance to be picked as a reviewer
weighted_reviewers = reviewers + hungry_reviewers + traintainers + traintainers
weighted_reviewers = reviewers + hungry_reviewers + traintainers + traintainers + traintainers + hungry_traintainers
reviewer = spin_for_person(weighted_reviewers, random: random, timezone_experiment: timezone_experiment)
maintainer = spin_for_person(maintainers, random: random, timezone_experiment: timezone_experiment)
......
......@@ -32,10 +32,8 @@ module Gitlab
projects&.has_key?(name)
end
# Traintainers also count as reviewers
def reviewer?(project, category, labels)
has_capability?(project, category, :reviewer, labels) ||
traintainer?(project, category, labels)
has_capability?(project, category, :reviewer, labels)
end
def traintainer?(project, category, labels)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment