From 919ba959bbc782315b0a8b171aa96e2118a43067 Mon Sep 17 00:00:00 2001 From: tkimia Date: Mon, 28 Apr 2014 00:00:47 -0400 Subject: fixed the db seeds. They can now be started --- app/models/match.rb | 1 + app/views/common/_show_tournament.html.erb | 6 ++++-- db/seeds.rb | 11 ++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/models/match.rb b/app/models/match.rb index d4c0ce5..ff81d68 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -12,6 +12,7 @@ class Match < ActiveRecord::Base ok = true tournament_stage.scoring_method.stats_needed.each do |stat| ok &= statistics.where(match: self, name: stat).nil? + end ok end diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb index 151e5d2..12a7fea 100644 --- a/app/views/common/_show_tournament.html.erb +++ b/app/views/common/_show_tournament.html.erb @@ -33,8 +33,10 @@ <% else %>

You've signed up for this tournament!

<% end %> - <%= form_tag(tournament_brackets_path(target), method: "post") do %> - <%= submit_tag("Make Bracket") %> + <% if target.status == 1 %> + <%= form_tag(tournament_brackets_path(target), method: "post") do %> + <%= submit_tag("Make Bracket") %> + <% end %> <% end %> <% end %> diff --git a/db/seeds.rb b/db/seeds.rb index a66cc4b..ea0338d 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -95,6 +95,7 @@ if Rails.env.development? rps = Tournament.create(game_id: 4, status: 0, name: "Rock, Paper, Scissors Seed", min_players_per_team: 1, max_players_per_team: 3, min_teams_per_match: 2, max_teams_per_match: 2, sampling_method: "manual") + rps.stages.create(scheduling_method: "elimination" , seeding_method: "random_seeding") rps.hosts.push(davis) rps.join(davis) rps.join(foy) @@ -109,6 +110,7 @@ if Rails.env.development? end tourn5.join(players_for_league[i]) end + tourn5.stages.create(scheduling_method: "elimination" , seeding_method: "random_seeding") tourn5.join(players_for_league[9]) tourn6 = Tournament.create(game_id: 1, status: 0, name: "3 teams per match", min_players_per_team: 1, max_players_per_team: 1, min_teams_per_match: 3, @@ -120,6 +122,7 @@ if Rails.env.development? end tourn6.join(players_for_league[i]) end + tourn6.stages.create(scheduling_method: "elimination" , seeding_method: "random_seeding") tourn6.join(players_for_league[9]) tourn6.join(davis) tourn6.join(foy) @@ -138,7 +141,13 @@ if Rails.env.development? hash4 = {:username => "NalfeinX", :id => id} hash5 = {:username => "GTBPhoenix", :id => id} hash6 = {:username => , :id => id} - hash7 = {:username => username, :id => id} + hash7 = {:username => username, :id => id}ages.first.create_matchesages.first.create_matches +end +if success +format.html { redirect_to @tournament, +end +if success +format.html { redirect_to @tournament, hash8 = {:username => username, :id => id} hash9 = {:username => username, :id => id} hash10 = {:username => username, :id => id} -- cgit v1.2.3