Skip to content
Snippets Groups Projects
Verified Commit 52169fbd authored by Alexandru Croitor's avatar Alexandru Croitor :three:
Browse files

Add merge request predictions fixture

Adding fixture to populate merge request suggested reviewers.
parent 218911be
No related branches found
No related tags found
1 merge request!100413Add merge request predictions fixture
......@@ -521,6 +521,7 @@ Style/ClassAndModuleChildren:
- 'ee/db/fixtures/development/21_dast_profiles.rb'
- 'ee/db/fixtures/development/30_customizable_cycle_analytics.rb'
- 'ee/db/fixtures/development/32_compliance_report_violations.rb'
- 'ee/db/fixtures/development/35_merge_request_predictions.rb'
- 'ee/db/fixtures/development/90_productivity_analytics.rb'
- 'ee/lib/ee/gitlab/analytics/cycle_analytics/aggregated/base_query_builder.rb'
- 'ee/lib/ee/gitlab/analytics/cycle_analytics/base_query_builder.rb'
......
# frozen_string_literal: true
class Gitlab::Seeder::MergeRequestPredictions
TOP_N_SUGGESTED_USERS = 5
VERSION = "0.0.0"
def seed!
MergeRequest.where.not(id: MergeRequest::Predictions.select(:merge_request_id)).find_each do |mr|
next if mr.predictions.present?
suggestion = {
"top_n": TOP_N_SUGGESTED_USERS,
"version": VERSION,
"reviewers": mr.project.team.users.sample(TOP_N_SUGGESTED_USERS).map(&:username)
}
mr.build_predictions
mr.predictions.update!(suggested_reviewers: suggestion)
print '.'
end
end
end
Gitlab::Seeder.quiet do
Gitlab::Seeder::MergeRequestPredictions.new.seed!
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment