mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-30 19:22:21 +00:00
Merge branch 'cleanup-existing'
This commit is contained in:
12
Gemfile
12
Gemfile
@@ -42,16 +42,6 @@ end
|
||||
gem 'devise'
|
||||
gem 'cancan'
|
||||
gem 'bootstrap-sass'
|
||||
gem 'mysql'
|
||||
|
||||
|
||||
# Use ActiveModel has_secure_password
|
||||
# gem 'bcrypt-ruby', '~> 3.1.2'
|
||||
|
||||
# Use unicorn as the app server
|
||||
# gem 'unicorn'
|
||||
|
||||
# Use Capistrano for deployment
|
||||
# gem 'capistrano', group: :development
|
||||
|
||||
# Use debugger
|
||||
# gem 'debugger', group: [:development, :test]
|
||||
|
||||
@@ -8,10 +8,8 @@ class StaticPagesController < ApplicationController
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
end
|
||||
if @tournament
|
||||
@matches = Match.where(tournament_id: @tournament.id)
|
||||
@bouts = @tournament.bouts
|
||||
end
|
||||
@matches = @matches.where(finished: nil)
|
||||
|
||||
end
|
||||
def results
|
||||
if params[:tournament]
|
||||
@@ -68,251 +66,7 @@ class StaticPagesController < ApplicationController
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
end
|
||||
if @tournament
|
||||
@matches_all = Match.where(tournament_id: @tournament.id)
|
||||
@matches_all.each do |match|
|
||||
match.destroy
|
||||
end
|
||||
@weights = Weight.where(tournament_id: @tournament.id)
|
||||
#ROUND 1
|
||||
@weights.order("id asc").each do |weight|
|
||||
@seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first
|
||||
@seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first
|
||||
@seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first
|
||||
@seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first
|
||||
@seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first
|
||||
@seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first
|
||||
@seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first
|
||||
@seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first
|
||||
@seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first
|
||||
@seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first
|
||||
@seed11 = Wrestler.where(weight_id: @weight.id, original_seed: 11).first
|
||||
@seed12 = Wrestler.where(weight_id: @weight.id, original_seed: 12).first
|
||||
@seed13 = Wrestler.where(weight_id: @weight.id, original_seed: 13).first
|
||||
@seed14 = Wrestler.where(weight_id: @weight.id, original_seed: 14).first
|
||||
@seed15 = Wrestler.where(weight_id: @weight.id, original_seed: 15).first
|
||||
@seed16 = Wrestler.where(weight_id: @weight.id, original_seed: 16).first
|
||||
@bracket_size = Wrestler.where(weight_id: weight.id).count
|
||||
def createMatch(r_id,g_id,tournament)
|
||||
@match = Match.new
|
||||
@match.r_id = r_id
|
||||
@match.g_id = g_id
|
||||
@match.tournament_id = tournament
|
||||
@match.round = 1
|
||||
@match.save
|
||||
end
|
||||
if @bracket_size == 16
|
||||
createMatch(@seed1.id,@seed16.id,@tournament.id)
|
||||
createMatch(@seed12.id,@seed8.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed15.id,@tournament.id)
|
||||
createMatch(@seed11.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed3.id,@seed14.id,@tournament.id)
|
||||
createMatch(@seed10.id,@seed6.id,@tournament.id)
|
||||
createMatch(@seed4.id,@seed13.id,@tournament.id)
|
||||
createMatch(@seed9.id,@seed5.id,@tournament.id)
|
||||
elsif @bracket_size == 10
|
||||
createMatch(@seed1.id,@seed10.id,@tournament.id)
|
||||
createMatch(@seed5.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed9.id,@tournament.id)
|
||||
createMatch(@seed6.id,@seed8.id,@tournament.id)
|
||||
elsif @bracket_size == 9
|
||||
createMatch(@seed1.id,@seed9.id,@tournament.id)
|
||||
createMatch(@seed5.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed6.id,@seed8.id,@tournament.id)
|
||||
elsif @bracket_size == 8
|
||||
createMatch(@seed5.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed6.id,@seed8.id,@tournament.id)
|
||||
elsif @bracket_size == 7
|
||||
createMatch(@seed5.id,@seed7.id,@tournament.id)
|
||||
end
|
||||
|
||||
end
|
||||
#ROUND 2
|
||||
@weights.order("id asc").each do |weight|
|
||||
@seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first
|
||||
@seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first
|
||||
@seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first
|
||||
@seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first
|
||||
@seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first
|
||||
@seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first
|
||||
@seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first
|
||||
@seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first
|
||||
@seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first
|
||||
@seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first
|
||||
@seed12 = Wrestler.where(weight_id: @weight.id, original_seed: 12).first
|
||||
@seed13 = Wrestler.where(weight_id: @weight.id, original_seed: 13).first
|
||||
@seed14 = Wrestler.where(weight_id: @weight.id, original_seed: 14).first
|
||||
@seed15 = Wrestler.where(weight_id: @weight.id, original_seed: 15).first
|
||||
@seed16 = Wrestler.where(weight_id: @weight.id, original_seed: 16).first
|
||||
@bracket_size = Wrestler.where(weight_id: weight.id).count
|
||||
def createMatch(r_id,g_id,tournament)
|
||||
@match = Match.new
|
||||
@match.r_id = r_id
|
||||
@match.g_id = g_id
|
||||
@match.tournament_id = tournament
|
||||
@match.round = 2
|
||||
@match.save
|
||||
end
|
||||
if @bracket_size == 16
|
||||
createMatch(@seed1.id,@seed12.id,@tournament.id)
|
||||
createMatch(@seed16.id,@seed8.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed11.id,@tournament.id)
|
||||
createMatch(@seed15.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed3.id,@seed10.id,@tournament.id)
|
||||
createMatch(@seed14.id,@seed6.id,@tournament.id)
|
||||
createMatch(@seed4.id,@seed9.id,@tournament.id)
|
||||
createMatch(@seed13.id,@seed5.id,@tournament.id)
|
||||
elsif @bracket_size == 10
|
||||
createMatch(@seed1.id,@seed5.id,@tournament.id)
|
||||
createMatch(@seed10.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed6.id,@tournament.id)
|
||||
createMatch(@seed9.id,@seed3.id,@tournament.id)
|
||||
elsif @bracket_size == 9
|
||||
createMatch(@seed1.id,@seed5.id,@tournament.id)
|
||||
createMatch(@seed9.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed6.id,@tournament.id)
|
||||
elsif @bracket_size == 8
|
||||
createMatch(@seed1.id,@seed5.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed6.id,@tournament.id)
|
||||
elsif @bracket_size == 7
|
||||
createMatch(@seed1.id,@seed5.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed6.id,@tournament.id)
|
||||
end
|
||||
|
||||
end
|
||||
#ROUND 3
|
||||
@weights.order("id asc").each do |weight|
|
||||
@seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first
|
||||
@seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first
|
||||
@seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first
|
||||
@seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first
|
||||
@seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first
|
||||
@seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first
|
||||
@seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first
|
||||
@seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first
|
||||
@seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first
|
||||
@seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first
|
||||
@seed12 = Wrestler.where(weight_id: @weight.id, original_seed: 12).first
|
||||
@seed13 = Wrestler.where(weight_id: @weight.id, original_seed: 13).first
|
||||
@seed14 = Wrestler.where(weight_id: @weight.id, original_seed: 14).first
|
||||
@seed15 = Wrestler.where(weight_id: @weight.id, original_seed: 15).first
|
||||
@seed16 = Wrestler.where(weight_id: @weight.id, original_seed: 16).first
|
||||
@bracket_size = Wrestler.where(weight_id: weight.id).count
|
||||
def createMatch(r_id,g_id,tournament)
|
||||
@match = Match.new
|
||||
@match.r_id = r_id
|
||||
@match.g_id = g_id
|
||||
@match.tournament_id = tournament
|
||||
@match.round = 3
|
||||
@match.save
|
||||
end
|
||||
if @bracket_size == 16
|
||||
createMatch(@seed1.id,@seed8.id,@tournament.id)
|
||||
createMatch(@seed12.id,@seed16.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed11.id,@seed15.id,@tournament.id)
|
||||
createMatch(@seed3.id,@seed6.id,@tournament.id)
|
||||
createMatch(@seed10.id,@seed14.id,@tournament.id)
|
||||
createMatch(@seed4.id,@seed5.id,@tournament.id)
|
||||
createMatch(@seed9.id,@seed13.id,@tournament.id)
|
||||
elsif @bracket_size == 10
|
||||
createMatch(@seed1.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed10.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed3.id,@tournament.id)
|
||||
createMatch(@seed8.id,@seed9.id,@tournament.id)
|
||||
elsif @bracket_size == 9
|
||||
createMatch(@seed1.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed9.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed3.id,@tournament.id)
|
||||
elsif @bracket_size == 8
|
||||
createMatch(@seed1.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed3.id,@tournament.id)
|
||||
elsif @bracket_size == 7
|
||||
createMatch(@seed1.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed3.id,@tournament.id)
|
||||
end
|
||||
|
||||
end
|
||||
#ROUND 4
|
||||
@weights.order("id asc").each do |weight|
|
||||
@seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first
|
||||
@seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first
|
||||
@seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first
|
||||
@seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first
|
||||
@seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first
|
||||
@seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first
|
||||
@seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first
|
||||
@seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first
|
||||
@seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first
|
||||
@seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first
|
||||
@bracket_size = Wrestler.where(weight_id: weight.id).count
|
||||
def createMatch(r_id,g_id,tournament)
|
||||
@match = Match.new
|
||||
@match.r_id = r_id
|
||||
@match.g_id = g_id
|
||||
@match.tournament_id = tournament
|
||||
@match.round = 4
|
||||
@match.save
|
||||
end
|
||||
if @bracket_size == 10
|
||||
createMatch(@seed1.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed5.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed8.id,@tournament.id)
|
||||
createMatch(@seed6.id,@seed3.id,@tournament.id)
|
||||
elsif @bracket_size == 9
|
||||
createMatch(@seed1.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed5.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed8.id,@tournament.id)
|
||||
createMatch(@seed6.id,@seed3.id,@tournament.id)
|
||||
elsif @bracket_size == 8
|
||||
createMatch(@seed1.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed5.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed2.id,@seed8.id,@tournament.id)
|
||||
createMatch(@seed6.id,@seed3.id,@tournament.id)
|
||||
elsif @bracket_size == 7
|
||||
createMatch(@seed1.id,@seed7.id,@tournament.id)
|
||||
createMatch(@seed5.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed6.id,@seed3.id,@tournament.id)
|
||||
end
|
||||
|
||||
end
|
||||
#ROUND 5
|
||||
@weights.order("id asc").each do |weight|
|
||||
@seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first
|
||||
@seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first
|
||||
@seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first
|
||||
@seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first
|
||||
@seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first
|
||||
@seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first
|
||||
@seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first
|
||||
@seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first
|
||||
@seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first
|
||||
@seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first
|
||||
@bracket_size = Wrestler.where(weight_id: weight.id).count
|
||||
def createMatch(r_id,g_id,tournament)
|
||||
@match = Match.new
|
||||
@match.r_id = r_id
|
||||
@match.g_id = g_id
|
||||
@match.tournament_id = tournament
|
||||
@match.round = 5
|
||||
@match.save
|
||||
end
|
||||
if @bracket_size == 10
|
||||
createMatch(@seed10.id,@seed5.id,@tournament.id)
|
||||
createMatch(@seed7.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed9.id,@seed6.id,@tournament.id)
|
||||
createMatch(@seed8.id,@seed3.id,@tournament.id)
|
||||
elsif @bracket_size == 9
|
||||
createMatch(@seed7.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed9.id,@seed5.id,@tournament.id)
|
||||
createMatch(@seed8.id,@seed3.id,@tournament.id)
|
||||
elsif @bracket_size == 8
|
||||
createMatch(@seed7.id,@seed4.id,@tournament.id)
|
||||
createMatch(@seed8.id,@seed3.id,@tournament.id)
|
||||
elsif @bracket_size == 7
|
||||
createMatch(@seed7.id,@seed4.id,@tournament.id)
|
||||
end
|
||||
|
||||
end
|
||||
@tournament.generateMatches
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -3,4 +3,20 @@ class Tournament < ActiveRecord::Base
|
||||
has_many :weights, dependent: :destroy
|
||||
has_many :matches, dependent: :destroy
|
||||
has_many :mats, dependent: :destroy
|
||||
|
||||
def generateMatches
|
||||
destroyAllMatches
|
||||
self.weights.each do |weight|
|
||||
puts weight.inspect
|
||||
weight.generatePool
|
||||
end
|
||||
end
|
||||
|
||||
def destroyAllMatches
|
||||
@matches_all = Match.where(tournament_id: self.id)
|
||||
@matches_all.each do |match|
|
||||
match.destroy
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,4 +1,33 @@
|
||||
class Weight < ActiveRecord::Base
|
||||
belongs_to :tournament
|
||||
has_many :wrestlers, dependent: :destroy
|
||||
|
||||
attr_accessor :pools
|
||||
|
||||
def generatePool
|
||||
@wrestlers = Wrestler.where(weight_id: self.id)
|
||||
poolNumber(@wrestlers)
|
||||
@wrestlers.each do |wrestler|
|
||||
puts wrestler.inspect
|
||||
|
||||
end
|
||||
puts 'Pool size:'
|
||||
puts self.pools
|
||||
end
|
||||
|
||||
def poolNumber(wrestlers)
|
||||
if wrestlers.size <= 5
|
||||
self.pools = 1
|
||||
elsif (wrestlers.size > 5) && (wrestlers.size <= 8)
|
||||
self.pools = 2
|
||||
elsif (wrestlers.size > 8) && (wrestlers.size <= 16)
|
||||
self.pools = 4
|
||||
end
|
||||
end
|
||||
|
||||
def fourPool
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<tr>
|
||||
<td>5. <%= @seed2.name %> <%= @seed2.season_win %>-<%= @seed2.season_loss %> <%= School.find(@seed2.school_id).name %></td>
|
||||
<td>BYE</td>
|
||||
<td>BYE</td>
|
||||
<td>V7</td>
|
||||
<td>V8</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -62,14 +62,14 @@
|
||||
<td>V7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>7. BYE</td>
|
||||
<td>7. <%= @seed10.name %> <%= @seed10.season_win %>-<%= @seed10.season_loss %> <%= School.find(@seed10.school_id).name %></td>
|
||||
<td>V8</td>
|
||||
<td>V5</td>
|
||||
<td>BYE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8. <%= @seed7.name %> <%= @seed7.season_win %>-<%= @seed7.season_loss %> <%= School.find(@seed7.school_id).name %></td>
|
||||
<td>BYE</td>
|
||||
<td>V7</td>
|
||||
<td>BYE</td>
|
||||
<td>V5</td>
|
||||
</tr>
|
||||
@@ -99,7 +99,7 @@
|
||||
<td>V11</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11. <%= @seed10.name %> <%= @seed10.season_win %>-<%= @seed10.season_loss %> <%= School.find(@seed10.school_id).name %></td>
|
||||
<td>11. <%= @seed9.name %> <%= @seed9.season_win %>-<%= @seed9.season_loss %> <%= School.find(@seed9.school_id).name %></td>
|
||||
<td>V12</td>
|
||||
<td>V9</td>
|
||||
<td>BYE</td>
|
||||
@@ -128,24 +128,24 @@
|
||||
<tr>
|
||||
<td>13. <%= @seed4.name %> <%= @seed4.season_win %>-<%= @seed4.season_loss %> <%= School.find(@seed4.school_id).name %></td>
|
||||
<td>BYE</td>
|
||||
<td>V15</td>
|
||||
<td>BYE</td>
|
||||
<td>V16</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>14. BYE</td>
|
||||
<td>V13</td>
|
||||
<td>V16</td>
|
||||
<td>V15</td>
|
||||
<td>BYE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>15. <%= @seed9.name %> <%= @seed9.season_win %>-<%= @seed9.season_loss %> <%= School.find(@seed9.school_id).name %></td>
|
||||
<td>15. BYE</td>
|
||||
<td>V16</td>
|
||||
<td>V13</td>
|
||||
<td>BYE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>16. <%= @seed5.name %> <%= @seed5.season_win %>-<%= @seed5.season_loss %> <%= School.find(@seed5.school_id).name %></td>
|
||||
<td>V15</td>
|
||||
<td>BYE</td>
|
||||
<td>BYE</td>
|
||||
<td>V13</td>
|
||||
</tr>
|
||||
|
||||
@@ -75,6 +75,8 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<br>
|
||||
<h3>Pool 3</h3>
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<h1>School Scores</h1>
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Score</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @school.each do |school| %>
|
||||
<tr>
|
||||
<td><%= school.name %></td>
|
||||
<td><%= school.score %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1,45 +1,8 @@
|
||||
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" %>
|
||||
<br>
|
||||
<br>
|
||||
<h3>Round 1</h3>
|
||||
<% @matches.each do |m| %>
|
||||
<% if m.round == 1 %>
|
||||
<%= Wrestler.find(m.r_id).weight.max %> Lbs <%= Wrestler.find(m.r_id).name %> vs. <%= Wrestler.find(m.g_id).name %> <% if user_signed_in? %><% if user_signed_in? %><%= link_to "Control Match", "/matches/#{m.id}/edit" %><% end %><% end %>
|
||||
<h3>Upcoming Matches</h3>
|
||||
<% @bouts.each do |m| %>
|
||||
<%= Wrestler.find(m.w1).weight.max %> Lbs <%= Wrestler.find(m.w1).name %> vs. Some Guy
|
||||
<br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h3>Round 2</h3>
|
||||
<% @matches.each do |m| %>
|
||||
<% if m.round == 2 %>
|
||||
<%= Wrestler.find(m.r_id).weight.max %> Lbs <%= Wrestler.find(m.r_id).name %> vs. <%= Wrestler.find(m.g_id).name %> <% if user_signed_in? %><%= link_to "Control Match", "/matches/#{m.id}/edit" %><% end %>
|
||||
<br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h3>Round 3</h3>
|
||||
<% @matches.each do |m| %>
|
||||
<% if m.round == 3 %>
|
||||
<%= Wrestler.find(m.r_id).weight.max %> Lbs <%= Wrestler.find(m.r_id).name %> vs. <%= Wrestler.find(m.g_id).name %> <% if user_signed_in? %><%= link_to "Control Match", "/matches/#{m.id}/edit" %><% end %>
|
||||
<br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h3>Round 4</h3>
|
||||
<% @matches.each do |m| %>
|
||||
<% if m.round == 4 %>
|
||||
<%= Wrestler.find(m.r_id).weight.max %> Lbs <%= Wrestler.find(m.r_id).name %> vs. <%= Wrestler.find(m.g_id).name %> <% if user_signed_in? %><%= link_to "Control Match", "/matches/#{m.id}/edit" %><% end %>
|
||||
<br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h3>Round 5</h3>
|
||||
<% @matches.each do |m| %>
|
||||
<% if m.round == 5 %>
|
||||
<%= Wrestler.find(m.r_id).weight.max %> Lbs <%= Wrestler.find(m.r_id).name %> vs. <%= Wrestler.find(m.g_id).name %> <% if user_signed_in? %><%= link_to "Control Match", "/matches/#{m.id}/edit" %><% end %>
|
||||
<br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h3>Round 6</h3>
|
||||
<% @matches.each do |m| %>
|
||||
<% if m.round == 6 %>
|
||||
<%= Wrestler.find(m.r_id).weight.max %> Lbs <%= @weight_class %> LBS <%= Wrestler.find(m.r_id).name %> vs. <%= Wrestler.find(m.g_id).name %> <% if user_signed_in? %><%= link_to "Control Match", "/matches/#{m.id}/edit" %><% end %>
|
||||
<br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -28,7 +28,7 @@
|
||||
<% if user_signed_in? %>
|
||||
<%= link_to "New #{@tournament.name} School" , "/schools/new?tournament=#{@tournament.id}" %>
|
||||
<br>
|
||||
BE CAREFUL <%= link_to "Generate Matches" , "/static_pages/generate_matches?tournament=#{@tournament.id}" %>
|
||||
BE CAREFUL <%= link_to "Generate Pool Matches" , "/static_pages/generate_matches?tournament=#{@tournament.id}" %>
|
||||
<% end %>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
@@ -9,6 +9,14 @@ development:
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
|
||||
|
||||
#adapter: mysql
|
||||
#encoding: utf8
|
||||
#database: wrestlingtourney
|
||||
#pool: 5
|
||||
#username: root
|
||||
#password: password
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
|
||||
28
db/seeds.rb
28
db/seeds.rb
@@ -5,3 +5,31 @@
|
||||
#
|
||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
||||
# Mayor.create(name: 'Emanuel', city: cities.first)
|
||||
if Rails.env.development?
|
||||
User.create(email: 'test@test.com', password: 'password', password_confirmation: 'password')
|
||||
Tournament.create(id: 200, name: 'test', address: 'some place', director: 'some guy', director_email: 'hismail@email.com')
|
||||
School.create(id: 200, name: 'Central Crossing', tournament_id: 200)
|
||||
Weight.create(id: 200, max: 132, tournament_id: 200 )
|
||||
Wrestler.create(name: 'Guy 1', school_id: 200, weight_id: 200, original_seed: 1, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 2', school_id: 200, weight_id: 200, original_seed: 2, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 3', school_id: 200, weight_id: 200, original_seed: 3, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 4', school_id: 200, weight_id: 200, original_seed: 4, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 5', school_id: 200, weight_id: 200, original_seed: 5, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 6', school_id: 200, weight_id: 200, original_seed: 6, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 7', school_id: 200, weight_id: 200, original_seed: 7, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 8', school_id: 200, weight_id: 200, original_seed: 8, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 9', school_id: 200, weight_id: 200, original_seed: 9, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 10', school_id: 200, weight_id: 200, original_seed: 10, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 11', school_id: 200, weight_id: 200, original_seed: 11, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 12', school_id: 200, weight_id: 200, original_seed: 12, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 13', school_id: 200, weight_id: 200, original_seed: 13, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 14', school_id: 200, weight_id: 200, original_seed: 14, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 15', school_id: 200, weight_id: 200, original_seed: 15, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 16', school_id: 200, weight_id: 200, original_seed: 16, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
end
|
||||
|
||||
if Rails.env.production?
|
||||
User.create(email: 'jacob.wimer@gmail.com', password: 'Welcome12', password_confirmation: 'Welcome12')
|
||||
end
|
||||
|
||||
|
||||
|
||||
1
refresh_wrestling_db.sh
Normal file
1
refresh_wrestling_db.sh
Normal file
@@ -0,0 +1 @@
|
||||
mysqldump -h db.codywimer.com -u heroku_jcw -p wrestlingtourney | mysql -h localhost -u root -ppassword wrestlingtourney
|
||||
1
set_up_dev_db.sh
Normal file
1
set_up_dev_db.sh
Normal file
@@ -0,0 +1 @@
|
||||
mysql -u root -ppassword -e 'CREATE DATABASE wrestlingtourney;'
|
||||
Reference in New Issue
Block a user