diff --git a/db/seeds.rb b/db/seeds.rb index 853470c..179d262 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -4,9 +4,21 @@ require 'faker' user = User.create! username: Faker::Internet.username, email: Faker::Internet.email, password: Faker::Internet.password tournament = user.tournaments.create! name: Faker::Dog.name -team1 = tournament.teams.create name: Faker::Dog.name -team2 = tournament.teams.create name: Faker::Dog.name -stage = tournament.stages.create! -match = stage.matches.create! -match.match_scores.create! team: team1, points: 0 -match.match_scores.create! team: team2, points: 1 + +@teams = [] +16.times do + team = tournament.teams.create name: Faker::HarryPotter.character + @teams << team +end +4.times do |i| + stage = tournament.stages.create! + stage.level = i + matches_amount = 2**i + matches_amount.times do |j| + match = stage.matches.create! + match.match_scores.create! team: @teams.sample, points: rand(10) + match.match_scores.create! team: @teams.sample, points: rand(10) + match.position = j + match.state = rand(7) + end +end