mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Renamed boutNumber to bout_number to make the field consistent with the rest of the domain and database schema.
This commit is contained in:
@@ -8,7 +8,7 @@ class Boutgen
|
||||
@matches = matches.sort_by{|x|[x.weight_max]}
|
||||
@matches.each_with_index do |m, i|
|
||||
@bout = m.round * 1000 + i
|
||||
m.boutNumber = @bout
|
||||
m.bout_number = @bout
|
||||
end
|
||||
return @matches
|
||||
end
|
||||
|
||||
@@ -17,8 +17,8 @@ class Losernamegen
|
||||
@match1 = matches.select{|m| m.loser1_name == "Winner Pool 1"}.first
|
||||
@match2 = matches.select{|m| m.loser1_name == "Winner Pool 2"}.first
|
||||
@matchChange = matches.select{|m| m.bracket_position == "3/4"}.first
|
||||
@matchChange.loser1_name = "Loser of #{@match1.boutNumber}"
|
||||
@matchChange.loser2_name = "Loser of #{@match2.boutNumber}"
|
||||
@matchChange.loser1_name = "Loser of #{@match1.bout_number}"
|
||||
@matchChange.loser2_name = "Loser of #{@match2.bout_number}"
|
||||
end
|
||||
|
||||
def fourPoolsToQuarterLoser(matches)
|
||||
@@ -29,18 +29,18 @@ class Losernamegen
|
||||
@seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first
|
||||
@consoSemis.each do |match|
|
||||
if match.bracket_position_number == 1
|
||||
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 1}.first.boutNumber}"
|
||||
match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 2}.first.boutNumber}"
|
||||
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 1}.first.bout_number}"
|
||||
match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 2}.first.bout_number}"
|
||||
elsif match.bracket_position_number == 2
|
||||
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 3}.first.boutNumber}"
|
||||
match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 4}.first.boutNumber}"
|
||||
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 3}.first.bout_number}"
|
||||
match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 4}.first.bout_number}"
|
||||
end
|
||||
end
|
||||
@thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.first.boutNumber}"
|
||||
@thirdFourth.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.first.boutNumber}"
|
||||
@thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.first.bout_number}"
|
||||
@thirdFourth.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
|
||||
@consoSemis = matches.select{|m| m.bracket_position == "Conso Semis"}
|
||||
@seventhEighth.loser1_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 1}.first.boutNumber}"
|
||||
@seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.boutNumber}"
|
||||
@seventhEighth.loser1_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 1}.first.bout_number}"
|
||||
@seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
|
||||
end
|
||||
|
||||
def fourPoolsToSemiLoser(matches)
|
||||
@@ -48,9 +48,9 @@ class Losernamegen
|
||||
@thirdFourth = matches.select{|m| m.bracket_position == "3/4"}.first
|
||||
@consoSemis = matches.select{|m| m.bracket_position == "Conso Semis"}
|
||||
@seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first
|
||||
@thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.first.boutNumber}"
|
||||
@thirdFourth.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.first.boutNumber}"
|
||||
@seventhEighth.loser1_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 1}.first.boutNumber}"
|
||||
@seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.boutNumber}"
|
||||
@thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.first.bout_number}"
|
||||
@thirdFourth.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
|
||||
@seventhEighth.loser1_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 1}.first.bout_number}"
|
||||
@seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
|
||||
end
|
||||
end
|
||||
@@ -27,7 +27,7 @@ class Wrestler < ActiveRecord::Base
|
||||
if @match.blank?
|
||||
return "BYE"
|
||||
else
|
||||
return @match.boutNumber
|
||||
return @match.bout_number
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -78,7 +78,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -90,7 +90,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -115,7 +115,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -140,7 +140,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -152,7 +152,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -177,7 +177,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
|
||||
@@ -66,7 +66,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -78,7 +78,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -104,7 +104,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -131,7 +131,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -143,7 +143,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -168,7 +168,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
|
||||
@@ -66,7 +66,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -90,7 +90,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
|
||||
@@ -66,7 +66,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -78,7 +78,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -104,7 +104,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<% @matches.each.map do |m| %>
|
||||
<tr>
|
||||
<td>Round <%= m.round %></td>
|
||||
<td><%= m.boutNumber %></td>
|
||||
<td><%= m.bout_number %></td>
|
||||
<td><%= m.weight_max %> lbs</td>
|
||||
<td><%= m.w1_name %> vs. <%= m.w2_name %></td>
|
||||
</tr>
|
||||
|
||||
5
db/migrate/201505170715923_rename_bout_number.rb
Normal file
5
db/migrate/201505170715923_rename_bout_number.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class RenameBoutNumber < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :matches, :boutNumber, :bout_number
|
||||
end
|
||||
end
|
||||
@@ -26,7 +26,7 @@ ActiveRecord::Schema.define(version: 20150427163818) do
|
||||
t.integer "tournament_id"
|
||||
t.integer "round"
|
||||
t.integer "finished"
|
||||
t.integer "boutNumber"
|
||||
t.integer "bout_number"
|
||||
t.integer "weight_id"
|
||||
t.string "bracket_position"
|
||||
t.integer "bracket_position_number"
|
||||
|
||||
@@ -70,14 +70,14 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
|
||||
refute_nil @tournament
|
||||
end
|
||||
|
||||
test "tests boutNumber matches round" do
|
||||
@matchup_to_test = @genMatchups.select{|m| m.boutNumber == 4000}.first
|
||||
test "tests bout_number matches round" do
|
||||
@matchup_to_test = @genMatchups.select{|m| m.bout_number == 4000}.first
|
||||
assert_equal 4, @matchup_to_test.round
|
||||
end
|
||||
|
||||
test "tests boutNumbers are generated with smallest weight first regardless of id" do
|
||||
test "tests bout_numbers are generated with smallest weight first regardless of id" do
|
||||
@weight = @tournament.weights.map.sort_by{|x|[x.max]}.first
|
||||
@matchup = @genMatchups.select{|m| m.boutNumber == 1000}.first
|
||||
@matchup = @genMatchups.select{|m| m.bout_number == 1000}.first
|
||||
assert_equal @weight.max, @matchup.weight_max
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user