BigW Consortium Gitlab

Commit a4a85c26 by Douwe Maan

Merge branch 'seed-fu-award-emoji' into 'master'

Seed Award Emoji while seeding the database ## What does this MR do? Lets `rake dev:setup` create award emoji on _some_ awardables. Seemed overkill to give all that privilege. See merge request !4555
parents bb7af46d b2df1185
Gitlab::Seeder.quiet do
emoji = Gitlab::AwardEmoji.emojis.keys
Issue.order(Gitlab::Database.random).limit(Issue.count / 2).each do |issue|
project = issue.project
project.team.users.sample(2).each do |user|
issue.create_award_emoji(emoji.sample, user)
issue.notes.sample(2).each do |note|
next if note.system?
note.create_award_emoji(emoji.sample, user)
end
print '.'
end
end
MergeRequest.order(Gitlab::Database.random).limit(MergeRequest.count / 2).each do |mr|
project = mr.project
project.team.users.sample(2).each do |user|
mr.create_award_emoji(emoji.sample, user)
mr.notes.sample(2).each do |note|
next if note.system?
note.create_award_emoji(emoji.sample, user)
end
print '.'
end
end
end
......@@ -30,6 +30,10 @@ module Gitlab
order
end
def self.random
Gitlab::Database.postgresql? ? "RANDOM()" : "RAND()"
end
def true_value
if Gitlab::Database.postgresql?
"'t'"
......
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