BigW Consortium Gitlab

15_award_emoji.rb 851 Bytes
Newer Older
1 2
require './spec/support/sidekiq'

3 4
Gitlab::Seeder.quiet do
  emoji = Gitlab::AwardEmoji.emojis.keys
5 6

  Issue.order(Gitlab::Database.random).limit(Issue.count / 2).each do |issue|
7 8
    project = issue.project

9
    project.team.users.sample(2).each do |user|
10 11
      issue.create_award_emoji(emoji.sample, user)

12 13 14 15 16
      issue.notes.sample(2).each do |note|
        next if note.system?
        note.create_award_emoji(emoji.sample, user)
      end

17 18 19 20
      print '.'
    end
  end

21
  MergeRequest.order(Gitlab::Database.random).limit(MergeRequest.count / 2).each do |mr|
22 23 24 25 26
    project = mr.project

    project.team.users.sample(2).each do |user|
      mr.create_award_emoji(emoji.sample, user)

27 28 29 30 31
      mr.notes.sample(2).each do |note|
        next if note.system?
        note.create_award_emoji(emoji.sample, user)
      end

32 33 34 35
      print '.'
    end
  end
end