Commit dea11717 authored by Sean McGivern's avatar Sean McGivern

Make trainee maintainers three times as likely to be picked

Trainee maintainers count as reviewers, but should get more reviews than
most reviewers, as they need practice to become a maintainer. This makes
them three times as likely to be picked (compared to another reviewer;
compared to before, it's roughly twice as likely at the current numbers
for each).

Also, switch to `Array#sample` because I think it looks nicer.
parent 0b7f9046
...@@ -31,13 +31,15 @@ MARKDOWN ...@@ -31,13 +31,15 @@ MARKDOWN
def spin(team, project, category) def spin(team, project, category)
reviewers = team.select { |member| member.reviewer?(project, category) } reviewers = team.select { |member| member.reviewer?(project, category) }
traintainers = team.select { |member| member.traintainer?(project, category) }
maintainers = team.select { |member| member.maintainer?(project, category) } maintainers = team.select { |member| member.maintainer?(project, category) }
# TODO: filter out people who are currently not in the office # TODO: filter out people who are currently not in the office
# TODO: take CODEOWNERS into account? # TODO: take CODEOWNERS into account?
reviewer = reviewers[rand(reviewers.size)] # Make traintainers have triple the chance to be picked as a reviewer
maintainer = maintainers[rand(maintainers.size)] reviewer = (reviewers + traintainers + traintainers).sample
maintainer = maintainers.sample
"| #{helper.label_for_category(category)} | #{reviewer&.markdown_name} | #{maintainer&.markdown_name} |" "| #{helper.label_for_category(category)} | #{reviewer&.markdown_name} | #{maintainer&.markdown_name} |"
end end
......
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