BigW Consortium Gitlab

15_award_emoji.rb 817 Bytes
Newer Older
1 2
Gitlab::Seeder.quiet do
  emoji = Gitlab::AwardEmoji.emojis.keys
3 4

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

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

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

15 16 17 18
      print '.'
    end
  end

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

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

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

30 31 32 33
      print '.'
    end
  end
end