1
0
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:
R.J. Osborne
2015-05-17 08:13:52 -04:00
parent f54937e9fe
commit f6dd4e8625
11 changed files with 45 additions and 40 deletions

View File

@@ -8,7 +8,7 @@ class Boutgen
@matches = matches.sort_by{|x|[x.weight_max]} @matches = matches.sort_by{|x|[x.weight_max]}
@matches.each_with_index do |m, i| @matches.each_with_index do |m, i|
@bout = m.round * 1000 + i @bout = m.round * 1000 + i
m.boutNumber = @bout m.bout_number = @bout
end end
return @matches return @matches
end end

View File

@@ -17,8 +17,8 @@ class Losernamegen
@match1 = matches.select{|m| m.loser1_name == "Winner Pool 1"}.first @match1 = matches.select{|m| m.loser1_name == "Winner Pool 1"}.first
@match2 = matches.select{|m| m.loser1_name == "Winner Pool 2"}.first @match2 = matches.select{|m| m.loser1_name == "Winner Pool 2"}.first
@matchChange = matches.select{|m| m.bracket_position == "3/4"}.first @matchChange = matches.select{|m| m.bracket_position == "3/4"}.first
@matchChange.loser1_name = "Loser of #{@match1.boutNumber}" @matchChange.loser1_name = "Loser of #{@match1.bout_number}"
@matchChange.loser2_name = "Loser of #{@match2.boutNumber}" @matchChange.loser2_name = "Loser of #{@match2.bout_number}"
end end
def fourPoolsToQuarterLoser(matches) def fourPoolsToQuarterLoser(matches)
@@ -29,18 +29,18 @@ class Losernamegen
@seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first @seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first
@consoSemis.each do |match| @consoSemis.each do |match|
if match.bracket_position_number == 1 if match.bracket_position_number == 1
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 1}.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.boutNumber}" match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 2}.first.bout_number}"
elsif match.bracket_position_number == 2 elsif match.bracket_position_number == 2
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 3}.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.boutNumber}" match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 4}.first.bout_number}"
end end
end end
@thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.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.boutNumber}" @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"} @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.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.boutNumber}" @seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
end end
def fourPoolsToSemiLoser(matches) def fourPoolsToSemiLoser(matches)
@@ -48,9 +48,9 @@ class Losernamegen
@thirdFourth = matches.select{|m| m.bracket_position == "3/4"}.first @thirdFourth = matches.select{|m| m.bracket_position == "3/4"}.first
@consoSemis = matches.select{|m| m.bracket_position == "Conso Semis"} @consoSemis = matches.select{|m| m.bracket_position == "Conso Semis"}
@seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first @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.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.boutNumber}" @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.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.boutNumber}" @seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
end end
end end

View File

@@ -27,7 +27,7 @@ class Wrestler < ActiveRecord::Base
if @match.blank? if @match.blank?
return "BYE" return "BYE"
else else
return @match.boutNumber return @match.bout_number
end end
end end

View File

@@ -66,7 +66,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -78,7 +78,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -90,7 +90,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -115,7 +115,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -140,7 +140,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -152,7 +152,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -177,7 +177,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>

View File

@@ -66,7 +66,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -78,7 +78,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -104,7 +104,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -131,7 +131,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -143,7 +143,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -168,7 +168,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>

View File

@@ -66,7 +66,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -90,7 +90,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>

View File

@@ -66,7 +66,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -78,7 +78,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -104,7 +104,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>

View File

@@ -23,7 +23,7 @@
<% @matches.each.map do |m| %> <% @matches.each.map do |m| %>
<tr> <tr>
<td>Round <%= m.round %></td> <td>Round <%= m.round %></td>
<td><%= m.boutNumber %></td> <td><%= m.bout_number %></td>
<td><%= m.weight_max %> lbs</td> <td><%= m.weight_max %> lbs</td>
<td><%= m.w1_name %> vs. <%= m.w2_name %></td> <td><%= m.w1_name %> vs. <%= m.w2_name %></td>
</tr> </tr>

View File

@@ -0,0 +1,5 @@
class RenameBoutNumber < ActiveRecord::Migration
def change
rename_column :matches, :boutNumber, :bout_number
end
end

View File

@@ -26,7 +26,7 @@ ActiveRecord::Schema.define(version: 20150427163818) do
t.integer "tournament_id" t.integer "tournament_id"
t.integer "round" t.integer "round"
t.integer "finished" t.integer "finished"
t.integer "boutNumber" t.integer "bout_number"
t.integer "weight_id" t.integer "weight_id"
t.string "bracket_position" t.string "bracket_position"
t.integer "bracket_position_number" t.integer "bracket_position_number"

View File

@@ -70,14 +70,14 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
refute_nil @tournament refute_nil @tournament
end end
test "tests boutNumber matches round" do test "tests bout_number matches round" do
@matchup_to_test = @genMatchups.select{|m| m.boutNumber == 4000}.first @matchup_to_test = @genMatchups.select{|m| m.bout_number == 4000}.first
assert_equal 4, @matchup_to_test.round assert_equal 4, @matchup_to_test.round
end 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 @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 assert_equal @weight.max, @matchup.weight_max
end end