diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 4b58505..0865258 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -9,7 +9,7 @@ class ApiController < ApplicationController if params[:search] @tournaments = Tournament.search(params[:search]).order("created_at DESC") else - @tournaments = Tournament.all.sort_by{|t| t.daysUntil}.first(20) + @tournaments = Tournament.all.sort_by{|t| t.days_until_start}.first(20) end end diff --git a/app/controllers/mats_controller.rb b/app/controllers/mats_controller.rb index 782c39e..69647ce 100644 --- a/app/controllers/mats_controller.rb +++ b/app/controllers/mats_controller.rb @@ -6,7 +6,7 @@ class MatsController < ApplicationController # GET /mats/1 # GET /mats/1.json def show - @match = @mat.unfinishedMatches.first + @match = @mat.unfinished_matches.first if @match @w1 = @match.wrestler1 @w2 = @match.wrestler2 diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index c12d371..d6fa0b5 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -4,7 +4,7 @@ class StaticPagesController < ApplicationController tournaments_created = current_user.tournaments tournaments_delegated = current_user.delegated_tournaments all_tournaments = tournaments_created + tournaments_delegated - @tournaments = all_tournaments.sort_by{|t| t.daysUntil} + @tournaments = all_tournaments.sort_by{|t| t.days_until_start} @schools = current_user.delegated_schools end diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 0a80e3b..422b09d 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -12,7 +12,7 @@ class TournamentsController < ApplicationController def swap @wrestler = Wrestler.find(params[:wrestler][:originalId]) respond_to do |format| - if SwapWrestlers.new.swapWrestlers(params[:wrestler][:originalId], params[:wrestler][:swapId]) + if SwapWrestlers.new.swap_wrestlers_bracket_lines(params[:wrestler][:originalId], params[:wrestler][:swapId]) format.html { redirect_to "/tournaments/#{@wrestler.tournament.id}/brackets/#{@wrestler.weight.id}", notice: 'Wrestler was successfully swaped.' } format.json { render action: 'show', status: :created, location: @wrestler } end @@ -143,7 +143,7 @@ class TournamentsController < ApplicationController def create_custom_weights @custom = params[:customValue].to_s - @tournament.createCustomWeights(@custom) + @tournament.create_pre_defined_weights(@custom) redirect_to "/tournaments/#{@tournament.id}" end @@ -157,7 +157,7 @@ class TournamentsController < ApplicationController @weight = Weight.where(:id => params[:weight]).includes(:matches,:wrestlers).first @matches = @weight.matches @wrestlers = @weight.wrestlers.includes(:school) - @pools = @weight.poolRounds(@matches) + @pools = @weight.pool_rounds(@matches) @bracketType = @weight.pool_bracket_type end end @@ -172,7 +172,7 @@ class TournamentsController < ApplicationController def team_scores @schools = @tournament.schools - @schools = @schools.sort_by{|s| s.pageScore}.reverse! + @schools = @schools.sort_by{|s| s.page_score_string}.reverse! end @@ -190,7 +190,7 @@ class TournamentsController < ApplicationController if params[:search] @tournaments = Tournament.search(params[:search]).order("created_at DESC") else - @tournaments = Tournament.all.sort_by{|t| t.daysUntil}.first(20) + @tournaments = Tournament.all.sort_by{|t| t.days_until_start}.first(20) end end @@ -276,7 +276,7 @@ class TournamentsController < ApplicationController end def check_tournament_errors - if @tournament.tournamentMatchGenerationError != nil + if @tournament.match_generation_error != nil respond_to do |format| format.html { redirect_to "/tournaments/#{@tournament.id}/error" } end diff --git a/app/models/mat.rb b/app/models/mat.rb index 59f3c9f..fab782d 100644 --- a/app/models/mat.rb +++ b/app/models/mat.rb @@ -6,21 +6,21 @@ class Mat < ActiveRecord::Base before_destroy do if tournament.matches.size > 0 - tournament.resetMats + tournament.reset_mats matsToAssign = tournament.mats.select{|m| m.id != self.id} - tournament.assignMats(matsToAssign) + tournament.assign_mats(matsToAssign) end end after_create do if tournament.matches.size > 0 - tournament.resetMats + tournament.reset_mats matsToAssign = tournament.mats - tournament.assignMats(matsToAssign) + tournament.assign_mats(matsToAssign) end end - def assignNextMatch + def assign_next_match t_matches = tournament.matches.select{|m| m.mat_id == nil && m.finished != 1 && m.bout_number != nil} if t_matches.size > 0 match = t_matches.sort_by{|m| m.bout_number}.first @@ -29,7 +29,7 @@ class Mat < ActiveRecord::Base end end - def unfinishedMatches + def unfinished_matches matches.select{|m| m.finished != 1}.sort_by{|m| m.bout_number} end diff --git a/app/models/match.rb b/app/models/match.rb index ac3bc7c..0378c90 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -13,19 +13,19 @@ class Match < ActiveRecord::Base wrestler2.touch end if self.mat - self.mat.assignNextMatch + self.mat.assign_next_match end advance_wrestlers - calcSchoolPoints + calculate_school_points end end WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default", "DQ"] - def calcSchoolPoints + def calculate_school_points if self.w1 && self.w2 - wrestler1.school.calcScore - wrestler2.school.calcScore + wrestler1.school.calculate_score + wrestler2.school.calculate_score end end @@ -38,12 +38,12 @@ class Match < ActiveRecord::Base end end - def pinTime + def pin_time_in_seconds if self.win_type == "Pin" time = self.score.delete("") - minInSeconds = time.partition(':').first.to_i * 60 + minutes_in_seconds = time.partition(':').first.to_i * 60 sec = time.partition(':').last.to_i - return minInSeconds + sec + return minutes_in_seconds + sec else nil end @@ -57,7 +57,7 @@ class Match < ActiveRecord::Base end - def bracketScore + def bracket_score_string if self.finished != 1 return "" end @@ -99,7 +99,7 @@ class Match < ActiveRecord::Base self.loser2_name end end - def winnerName + def winner_name if self.finished != 1 return "" end @@ -114,17 +114,17 @@ class Match < ActiveRecord::Base self.weight.max end - def replaceLoserNameWithWrestler(w,loserName) - if self.loser1_name == loserName + def replace_loser_name_with_wrestler(w,loser_name) + if self.loser1_name == loser_name self.w1 = w.id self.save end - if self.loser2_name == loserName + if self.loser2_name == loser_name self.w2 = w.id self.save end end - def poolNumber + def pool_number if self.w1? wrestler1.pool end diff --git a/app/models/school.rb b/app/models/school.rb index 1da7707..2181e74 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -7,11 +7,11 @@ class School < ActiveRecord::Base validates :name, presence: true before_destroy do - self.tournament.destroyAllMatches + self.tournament.destroy_all_matches end #calculate score here - def pageScore + def page_score_string if self.score == nil return 0.0 else @@ -19,26 +19,26 @@ class School < ActiveRecord::Base end end - def calcScore - newScore = totalWrestlerPoints - totalDeductedPoints + def calculate_score + newScore = total_points_scored_by_wrestlers - total_points_deducted self.score = newScore self.save end if Rails.env.production? - handle_asynchronously :calcScore + handle_asynchronously :calculate_score end - def totalWrestlerPoints + def total_points_scored_by_wrestlers points = 0 self.wrestlers.each do |w| if w.extra != true - points = points + w.totalTeamPoints + points = points + w.total_team_points end end points end - def totalDeductedPoints + def total_points_deducted points = 0 deductedPoints.each do |d| points = points + d.points diff --git a/app/models/teampointadjust.rb b/app/models/teampointadjust.rb index ff61f81..9ff18a3 100644 --- a/app/models/teampointadjust.rb +++ b/app/models/teampointadjust.rb @@ -15,9 +15,9 @@ class Teampointadjust < ActiveRecord::Base if self.wrestler_id != nil #In case this affects pool order AdvanceWrestler.new(self.wrestler).advance - self.wrestler.school.calcScore + self.wrestler.school.calculate_score elsif self.school_id != nil - self.school.calcScore + self.school.calculate_score end end diff --git a/app/models/tournament.rb b/app/models/tournament.rb index 19dff17..784a783 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -14,7 +14,7 @@ class Tournament < ActiveRecord::Base where("date LIKE ? or name LIKE ?", "%#{search}%", "%#{search}%") end - def daysUntil + def days_until_start time = (Date.today - self.date).to_i if time < 0 time = time * -1 @@ -26,7 +26,7 @@ class Tournament < ActiveRecord::Base ["Pool to bracket"] end - def createCustomWeights(value) + def create_pre_defined_weights(value) weights.destroy_all if value == 'hs' Weight::HS_WEIGHT_CLASSES.each do |w| @@ -37,32 +37,32 @@ class Tournament < ActiveRecord::Base end end - def destroyAllMatches + def destroy_all_matches matches.destroy_all end - def matchesByRound(round) + def matches_by_round(round) matches.joins(:weight).where(round: round).order("weights.max") end - def totalRounds + def total_rounds self.matches.sort_by{|m| m.round}.last.round end - def assignMats(matsToAssign) - if matsToAssign.count > 0 - until matsToAssign.sort_by{|m| m.id}.last.matches.count == 4 - matsToAssign.sort_by{|m| m.id}.each do |m| - m.assignNextMatch + def assign_mats(mats_to_assign) + if mats_to_assign.count > 0 + until mats_to_assign.sort_by{|m| m.id}.last.matches.count == 4 + mats_to_assign.sort_by{|m| m.id}.each do |m| + m.assign_next_match end end end end - def resetMats - matchesToReset = matches.select{|m| m.mat_id != nil} - # matchesToReset.update_all( {:mat_id => nil } ) - matchesToReset.each do |m| + def reset_mats + matches_to_reset = matches.select{|m| m.mat_id != nil} + # matches_to_reset.update_all( {:mat_id => nil } ) + matches_to_reset.each do |m| m.mat_id = nil m.save end @@ -83,7 +83,7 @@ class Tournament < ActiveRecord::Base point_adjustments end - def removeSchoolDelegations + def remove_school_delegations self.schools.each do |s| s.delegates.each do |d| d.destroy @@ -91,7 +91,7 @@ class Tournament < ActiveRecord::Base end end - def poolToBracketWeightsWithTooManyWrestlers + def pool_to_bracket_weights_with_too_many_wrestlers if self.tournament_type == "Pool to bracket" weightsWithTooManyWrestlers = weights.select{|w| w.wrestlers.size > 16} if weightsWithTooManyWrestlers.size < 1 @@ -104,11 +104,11 @@ class Tournament < ActiveRecord::Base end end - def tournamentMatchGenerationError + def match_generation_error errorString = "There is a tournament error." - if poolToBracketWeightsWithTooManyWrestlers != nil + if pool_to_bracket_weights_with_too_many_wrestlers != nil errorString = errorString + " The following weights have too many wrestlers " - poolToBracketWeightsWithTooManyWrestlers.each do |w| + pool_to_bracket_weights_with_too_many_wrestlers.each do |w| errorString = errorString + "#{w.max} " end return errorString diff --git a/app/models/weight.rb b/app/models/weight.rb index c5b310d..7814622 100644 --- a/app/models/weight.rb +++ b/app/models/weight.rb @@ -10,18 +10,18 @@ class Weight < ActiveRecord::Base HS_WEIGHT_CLASSES = [106,113,120,126,132,138,145,152,160,170,182,195,220,285] before_destroy do - self.tournament.destroyAllMatches + self.tournament.destroy_all_matches end before_save do - # self.tournament.destroyAllMatches + # self.tournament.destroy_all_matches end def pools_with_bye pool = 1 pools_with_a_bye = [] until pool > self.pools do - if wrestlersForPool(pool).first.hasAPoolBye + if wrestlers_in_pool(pool).first.has_a_pool_bye pools_with_a_bye << pool end pool = pool + 1 @@ -29,19 +29,19 @@ class Weight < ActiveRecord::Base pools_with_a_bye end - def wrestlersForPool(poolNumber) + def wrestlers_in_pool(pool_number) #For some reason this does not work - # wrestlers.select{|w| w.pool == poolNumber} + # wrestlers.select{|w| w.pool == pool_number} #This does... - weightWrestlers = Wrestler.where(:weight_id => self.id) - weightWrestlers.select{|w| w.pool == poolNumber} + weight_wrestlers = Wrestler.where(:weight_id => self.id) + weight_wrestlers.select{|w| w.pool == pool_number} end - def allPoolMatchesFinished(pool) - @wrestlers = wrestlersForPool(pool) + def all_pool_matches_finished(pool) + @wrestlers = wrestlers_in_pool(pool) @wrestlers.each do |w| - if w.poolMatches.size != w.finishedPoolMatches.size + if w.pool_matches.size != w.finished_pool_matches.size return false end end @@ -59,14 +59,14 @@ class Weight < ActiveRecord::Base end end - def poolSeedOrder(pool) - # wrestlersForPool(pool).sort_by{|w| [w.original_seed ? 0 : 1, w.original_seed || 0]} - return wrestlersForPool(pool).sort_by{|w|w.bracket_line} + def pool_wrestlers_sorted_by_bracket_line(pool) + # wrestlers_in_pool(pool).sort_by{|w| [w.original_seed ? 0 : 1, w.original_seed || 0]} + return wrestlers_in_pool(pool).sort_by{|w|w.bracket_line} end - def swapWrestlers(wrestler1_id,wrestler2_id) - SwapWrestlers.new.swapWrestlers(wrestler1_id,wrestler2_id) + def swap_wrestlers_bracket_lines(wrestler1_id,wrestler2_id) + SwapWrestlers.new.swap_wrestlers_bracket_lines(wrestler1_id,wrestler2_id) end @@ -86,13 +86,13 @@ class Weight < ActiveRecord::Base end end - def poolRounds(matches) - @matchups = matches.select{|m| m.weight_id == self.id} - @poolMatches = @matchups.select{|m| m.bracket_position == "Pool"} - return @poolMatches.sort_by{|m| m.round}.last.round + def pool_rounds(matches) + matchups = matches.select{|m| m.weight_id == self.id} + pool_matches = matchups.select{|m| m.bracket_position == "Pool"} + return pool_matches.sort_by{|m| m.round}.last.round end - def totalRounds(matches) + def total_rounds(matches) @matchups = matches.select{|m| m.weight_id == self.id} @lastRound = matches.sort_by{|m| m.round}.last.round count = 0 @@ -106,11 +106,11 @@ class Weight < ActiveRecord::Base return count end - def poolOrder(pool) - PoolOrder.new(wrestlersForPool(pool)).getPoolOrder + def pool_placement_order(pool) + PoolOrder.new(wrestlers_in_pool(pool)).getPoolOrder end - def wrestlersWithoutPool + def wrestlers_without_pool_assignment wrestlers.select{|w| w.pool == nil} end diff --git a/app/models/wrestler.rb b/app/models/wrestler.rb index c20358e..db7825b 100644 --- a/app/models/wrestler.rb +++ b/app/models/wrestler.rb @@ -9,102 +9,102 @@ class Wrestler < ActiveRecord::Base validates :name, :weight_id, :school_id, presence: true before_destroy do - # self.tournament.destroyAllMatches + # self.tournament.destroy_all_matches end before_create do - # self.tournament.destroyAllMatches + # self.tournament.destroy_all_matches end - def lastFinishedMatch - allMatches.select{|m| m.finished == 1}.sort_by{|m| m.bout_number}.last + def last_finished_match + all_matches.select{|m| m.finished == 1}.sort_by{|m| m.bout_number}.last end - def totalTeamPoints + def total_team_points CalculateWrestlerTeamScore.new(self).totalScore end - def teamPointsEarned + def team_points_earned CalculateWrestlerTeamScore.new(self).earnedPoints end - def placementPoints - CalculateWrestlerTeamScore.new(self).placementPoints + def placement_points + CalculateWrestlerTeamScore.new(self).placement_points end - def totalDeductedPoints + def total_points_deducted CalculateWrestlerTeamScore.new(self).deductedPoints end - def nextMatch - unfinishedMatches.first + def next_match + unfinished_matches.first end - def nextMatchPositionNumber - pos = lastMatch.bracket_position_number + def next_match_position_number + pos = last_match.bracket_position_number return (pos/2.0) end - def lastMatch - finishedMatches.sort_by{|m| m.round}.reverse.first + def last_match + finished_matches.sort_by{|m| m.round}.reverse.first end - def winnerOfLastMatch? - if lastMatch.winner_id == self.id + def winner_of_last_match? + if last_match.winner_id == self.id return true else return false end end - def nextMatchBoutNumber - if nextMatch - nextMatch.bout_number + def next_match_bout_number + if next_match + next_match.bout_number else "" end end - def nextMatchMatName - if nextMatch - nextMatch.mat_assigned + def next_match_mat_name + if next_match + next_match.mat_assigned else "" end end - def unfinishedMatches - allMatches.select{|m| m.finished != 1}.sort_by{|m| m.bout_number} + def unfinished_matches + all_matches.select{|m| m.finished != 1}.sort_by{|m| m.bout_number} end - def resultByBout(bout) - bout_match = allMatches.select{|m| m.bout_number == bout and m.finished == 1} + def result_by_bout(bout) + bout_match = all_matches.select{|m| m.bout_number == bout and m.finished == 1} if bout_match.size == 0 return "" end if bout_match.first.winner_id == self.id - return "W #{bout_match.first.bracketScore}" + return "W #{bout_match.first.bracket_score_string}" end if bout_match.first.winner_id != self.id - return "L #{bout_match.first.bracketScore}" + return "L #{bout_match.first.bracket_score_string}" end end - def matchAgainst(opponent) - allMatches.select{|m| m.w1 == opponent.id or m.w2 == opponent.id} + def match_against(opponent) + all_matches.select{|m| m.w1 == opponent.id or m.w2 == opponent.id} end - def isWrestlingThisRound(matchRound) - if allMatches.blank? + def is_wrestling_this_round(matchRound) + if all_matches.blank? return false else return true end end - def boutByRound(round) - round_match = allMatches.select{|m| m.round == round}.first + def bout_by_round(round) + round_match = all_matches.select{|m| m.round == round}.first if round_match.blank? return "BYE" else @@ -112,93 +112,93 @@ class Wrestler < ActiveRecord::Base end end - def allMatches + def all_matches return matches.select{|m| m.w1 == self.id or m.w2 == self.id} end - def poolMatches - pool_matches = allMatches.select{|m| m.bracket_position == "Pool"} - pool_matches.select{|m| m.poolNumber == self.pool} + def pool_matches + all_weight_pool_matches = all_matches.select{|m| m.bracket_position == "Pool"} + all_weight_pool_matches.select{|m| m.pool_number == self.pool} end - def hasAPoolBye - if weight.poolRounds(matches) > poolMatches.size + def has_a_pool_bye + if weight.pool_rounds(matches) > pool_matches.size return true else return false end end - def championshipAdvancementWins - matchesWon.select{|m| m.bracket_position == "Quarter" or m.bracket_position == "Semis"} + def championship_advancement_wins + matches_won.select{|m| m.bracket_position == "Quarter" or m.bracket_position == "Semis"} end - def consoAdvancementWins - matchesWon.select{|m| m.bracket_position == "Conso Semis"} + def consolation_advancement_wins + matches_won.select{|m| m.bracket_position == "Conso Semis"} end - def finishedMatches - allMatches.select{|m| m.finished == 1} + def finished_matches + all_matches.select{|m| m.finished == 1} end - def finishedBracketMatches - finishedMatches.select{|m| m.bracket_position != "Pool"} + def finished_bracket_matches + finished_matches.select{|m| m.bracket_position != "Pool"} end - def finishedPoolMatches - finishedMatches.select{|m| m.bracket_position == "Pool"} + def finished_pool_matches + finished_matches.select{|m| m.bracket_position == "Pool"} end - def matchesWon - allMatches.select{|m| m.winner_id == self.id} + def matches_won + all_matches.select{|m| m.winner_id == self.id} end - def poolWins - matchesWon.select{|m| m.bracket_position == "Pool"} + def pool_wins + matches_won.select{|m| m.bracket_position == "Pool"} end - def pinWins - matchesWon.select{|m| m.win_type == "Pin" || m.win_type == "Forfeit" || m.win_type == "Injury Default" || m.win_type == "Default" || m.win_type == "DQ"} + def pin_wins + matches_won.select{|m| m.win_type == "Pin" || m.win_type == "Forfeit" || m.win_type == "Injury Default" || m.win_type == "Default" || m.win_type == "DQ"} end - def techWins - matchesWon.select{|m| m.win_type == "Tech Fall" } + def tech_wins + matches_won.select{|m| m.win_type == "Tech Fall" } end - def majorWins - matchesWon.select{|m| m.win_type == "Major" } + def major_wins + matches_won.select{|m| m.win_type == "Major" } end - def decisionWins - matchesWon.select{|m| m.win_type == "Decision" } + def decision_wins + matches_won.select{|m| m.win_type == "Decision" } end - def decisionPointsScored - pointsScored = 0 - decisionWins.each do |m| - scoreOfMatch = m.score.delete(" ") - scoreOne = scoreOfMatch.partition('-').first.to_i - scoreTwo = scoreOfMatch.partition('-').last.to_i - if scoreOne > scoreTwo - pointsScored = pointsScored + scoreOne - elsif scoreTwo > scoreOne - pointsScored = pointsScored + scoreTwo + def decision_points_scored + points_scored = 0 + decision_wins.each do |m| + score_of_match = m.score.delete(" ") + score_one = score_of_match.partition('-').first.to_i + score_two = score_of_match.partition('-').last.to_i + if score_one > score_two + points_scored = points_scored + score_one + elsif score_two > score_one + points_scored = points_scored + score_two end end - pointsScored + points_scored end - def fastestPin - pinWins.sort_by{|m| m.pinTime}.first + def fastest_pin + pin_wins.sort_by{|m| m.pin_time_in_seconds}.first end - def seasonWinPercentage + def season_win_percentage win = self.season_win.to_f loss = self.season_loss.to_f if win > 0 and loss != nil - matchTotal = win + loss - percentageDec = win / matchTotal - percentage = percentageDec * 100 + match_total = win + loss + percentage_dec = win / match_total + percentage = percentage_dec * 100 return percentage.to_i elsif self.season_win == 0 return 0 diff --git a/app/services/bracket_advancement/advance_wrestler.rb b/app/services/bracket_advancement/advance_wrestler.rb index b7ec03c..b259677 100644 --- a/app/services/bracket_advancement/advance_wrestler.rb +++ b/app/services/bracket_advancement/advance_wrestler.rb @@ -5,7 +5,7 @@ class AdvanceWrestler end def advance - PoolAdvance.new(@wrestler,@wrestler.lastMatch).advanceWrestler if @tournament.tournament_type == "Pool to bracket" + PoolAdvance.new(@wrestler,@wrestler.last_match).advanceWrestler if @tournament.tournament_type == "Pool to bracket" end if Rails.env.production? handle_asynchronously :advance diff --git a/app/services/bracket_advancement/pool_advance.rb b/app/services/bracket_advancement/pool_advance.rb index e708dd9..e6427b4 100644 --- a/app/services/bracket_advancement/pool_advance.rb +++ b/app/services/bracket_advancement/pool_advance.rb @@ -6,10 +6,10 @@ class PoolAdvance end def advanceWrestler - if @wrestler.weight.allPoolMatchesFinished(@wrestler.pool) && @wrestler.finishedBracketMatches.size == 0 + if @wrestler.weight.all_pool_matches_finished(@wrestler.pool) && @wrestler.finished_bracket_matches.size == 0 poolToBracketAdvancment end - if @wrestler.finishedBracketMatches.size > 0 + if @wrestler.finished_bracket_matches.size > 0 bracketAdvancment end end @@ -17,15 +17,15 @@ class PoolAdvance def poolToBracketAdvancment pool = @wrestler.pool if @wrestler.weight.wrestlers.size > 6 - poolOrder = @wrestler.weight.poolOrder(pool) + pool_placement_order = @wrestler.weight.pool_placement_order(pool) #Take pool order and move winner and runner up to correct match based on w1_name and w2_name matches = @wrestler.weight.matches winnerMatch = matches.select{|m| m.loser1_name == "Winner Pool #{pool}" || m.loser2_name == "Winner Pool #{pool}"}.first runnerUpMatch = matches.select{|m| m.loser1_name == "Runner Up Pool #{pool}" || m.loser2_name == "Runner Up Pool #{pool}"}.first - winner = poolOrder.first - runnerUp = poolOrder.second - runnerUpMatch.replaceLoserNameWithWrestler(runnerUp,"Runner Up Pool #{pool}") - winnerMatch.replaceLoserNameWithWrestler(winner,"Winner Pool #{pool}") + winner = pool_placement_order.first + runnerUp = pool_placement_order.second + runnerUpMatch.replace_loser_name_with_wrestler(runnerUp,"Runner Up Pool #{pool}") + winnerMatch.replace_loser_name_with_wrestler(winner,"Winner Pool #{pool}") end end @@ -39,37 +39,37 @@ class PoolAdvance end def winnerAdvance - if @wrestler.lastMatch.bracket_position == "Quarter" - new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","Semis",@wrestler.nextMatchPositionNumber.ceil,@wrestler.weight_id).first + if @wrestler.last_match.bracket_position == "Quarter" + new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","Semis",@wrestler.next_match_position_number.ceil,@wrestler.weight_id).first updateNewMatch(new_match) end - if @wrestler.lastMatch.bracket_position == "Semis" - new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","1/2",@wrestler.nextMatchPositionNumber.ceil,@wrestler.weight_id).first + if @wrestler.last_match.bracket_position == "Semis" + new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","1/2",@wrestler.next_match_position_number.ceil,@wrestler.weight_id).first updateNewMatch(new_match) end - if @wrestler.lastMatch.bracket_position == "Conso Semis" - new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","5/6",@wrestler.nextMatchPositionNumber.ceil,@wrestler.weight_id).first + if @wrestler.last_match.bracket_position == "Conso Semis" + new_match = Match.where("bracket_position = ? AND bracket_position_number = ? AND weight_id = ?","5/6",@wrestler.next_match_position_number.ceil,@wrestler.weight_id).first updateNewMatch(new_match) end end def updateNewMatch(match) - if @wrestler.nextMatchPositionNumber == @wrestler.nextMatchPositionNumber.ceil + if @wrestler.next_match_position_number == @wrestler.next_match_position_number.ceil match.w2 = @wrestler.id match.save end - if @wrestler.nextMatchPositionNumber != @wrestler.nextMatchPositionNumber.ceil + if @wrestler.next_match_position_number != @wrestler.next_match_position_number.ceil match.w1 = @wrestler.id match.save end end def loserAdvance - bout = @wrestler.lastMatch.bout_number + bout = @wrestler.last_match.bout_number next_match = Match.where("(loser1_name = ? OR loser2_name = ?) AND weight_id = ?","Loser of #{bout}","Loser of #{bout}",@wrestler.weight_id) if next_match.size > 0 - next_match.first.replaceLoserNameWithWrestler(@wrestler,"Loser of #{bout}") + next_match.first.replace_loser_name_with_wrestler(@wrestler,"Loser of #{bout}") end end end diff --git a/app/services/bracket_advancement/pool_order.rb b/app/services/bracket_advancement/pool_order.rb index a03eebe..b39b61a 100644 --- a/app/services/bracket_advancement/pool_order.rb +++ b/app/services/bracket_advancement/pool_order.rb @@ -13,7 +13,7 @@ class PoolOrder def setOriginalPoints @wrestlers.each do |w| - w.poolAdvancePoints = w.poolWins.size + w.poolAdvancePoints = w.pool_wins.size end end @@ -50,7 +50,7 @@ class PoolOrder ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { mostTechs } ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { mostMajors } ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { mostDecisionPointsScored } - ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { fastestPin } + ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { fastest_pin } ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { coinFlip } end @@ -58,7 +58,7 @@ class PoolOrder def headToHead wrestlersWithSamePoints.each do |wr| otherWrestler = wrestlersWithSamePoints.select{|w| w.id != wr.id}.first - if wr.matchAgainst(otherWrestler).first.winner_id == wr.id + if wr.match_against(otherWrestler).first.winner_id == wr.id addPointsToWrestlersAhead(wr) addPoints(wr) end @@ -79,10 +79,10 @@ class PoolOrder def deductedPoints pointsArray = [] wrestlersWithSamePoints.each do |w| - pointsArray << w.totalDeductedPoints + pointsArray << w.total_points_deducted end leastPoints = pointsArray.min - wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.totalDeductedPoints == leastPoints} + wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.total_points_deducted == leastPoints} addPointsToWrestlersAhead(wrestlersWithLeastDeductedPoints.first) wrestlersWithLeastDeductedPoints.each do |wr| addPoints(wr) @@ -92,39 +92,39 @@ class PoolOrder def mostDecisionPointsScored pointsArray = [] wrestlersWithSamePoints.each do |w| - pointsArray << w.decisionPointsScored + pointsArray << w.decision_points_scored end mostPoints = pointsArray.max - wrestlersWithMostPoints = wrestlersWithSamePoints.select{|w| w.decisionPointsScored == mostPoints} + wrestlersWithMostPoints = wrestlersWithSamePoints.select{|w| w.decision_points_scored == mostPoints} addPointsToWrestlersAhead(wrestlersWithMostPoints.first) wrestlersWithMostPoints.each do |wr| addPoints(wr) end secondPoints = pointsArray.sort[-2] - wrestlersWithSecondMostPoints = wrestlersWithSamePoints.select{|w| w.decisionPointsScored == secondPoints} + wrestlersWithSecondMostPoints = wrestlersWithSamePoints.select{|w| w.decision_points_scored == secondPoints} addPointsToWrestlersAhead(wrestlersWithSecondMostPoints.first) wrestlersWithSecondMostPoints.each do |wr| addPoints(wr) end end - def fastestPin + def fastest_pin wrestlersWithSamePointsWithPins = [] wrestlersWithSamePoints.each do |wr| - if wr.pinWins.size > 0 + if wr.pin_wins.size > 0 wrestlersWithSamePointsWithPins << wr end end if wrestlersWithSamePointsWithPins.size > 0 - fastest = wrestlersWithSamePointsWithPins.sort_by{|w| w.fastestPin.pinTime}.first.fastestPin - secondFastest = wrestlersWithSamePointsWithPins.sort_by{|w| w.fastestPin.pinTime}.second.fastestPin - wrestlersWithFastestPin = wrestlersWithSamePointsWithPins.select{|w| w.fastestPin.pinTime == fastest.pinTime} + fastest = wrestlersWithSamePointsWithPins.sort_by{|w| w.fastest_pin.pin_time_in_seconds}.first.fastest_pin + secondFastest = wrestlersWithSamePointsWithPins.sort_by{|w| w.fastest_pin.pin_time_in_seconds}.second.fastest_pin + wrestlersWithFastestPin = wrestlersWithSamePointsWithPins.select{|w| w.fastest_pin.pin_time_in_seconds == fastest.pin_time_in_seconds} addPointsToWrestlersAhead(wrestlersWithFastestPin.first) wrestlersWithFastestPin.each do |wr| addPoints(wr) end - wrestlersWithSecondFastestPin = wrestlersWithSamePointsWithPins.select{|w| w.fastestPin.pinTime == secondFastest.pinTime} + wrestlersWithSecondFastestPin = wrestlersWithSamePointsWithPins.select{|w| w.fastest_pin.pin_time_in_seconds == secondFastest.pin_time_in_seconds} addPointsToWrestlersAhead(wrestlersWithSecondFastestPin.first) wrestlersWithSecondFastestPin.each do |wr| addPoints(wr) @@ -135,10 +135,10 @@ class PoolOrder def teamPoints pointsArray = [] wrestlersWithSamePoints.each do |w| - pointsArray << w.teamPointsEarned + pointsArray << w.team_points_earned end mostPoints = pointsArray.max - wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.teamPointsEarned == mostPoints} + wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.team_points_earned == mostPoints} addPointsToWrestlersAhead(wrestlersWithLeastDeductedPoints.first) wrestlersWithLeastDeductedPoints.each do |wr| addPoints(wr) @@ -148,10 +148,10 @@ class PoolOrder def mostFalls pointsArray = [] wrestlersWithSamePoints.each do |w| - pointsArray << w.pinWins.size + pointsArray << w.pin_wins.size end mostPoints = pointsArray.max - wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.pinWins.size == mostPoints} + wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.pin_wins.size == mostPoints} addPointsToWrestlersAhead(wrestlersWithLeastDeductedPoints.first) wrestlersWithLeastDeductedPoints.each do |wr| addPoints(wr) @@ -161,10 +161,10 @@ class PoolOrder def mostTechs pointsArray = [] wrestlersWithSamePoints.each do |w| - pointsArray << w.techWins.size + pointsArray << w.tech_wins.size end mostPoints = pointsArray.max - wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.techWins.size == mostPoints} + wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.tech_wins.size == mostPoints} addPointsToWrestlersAhead(wrestlersWithLeastDeductedPoints.first) wrestlersWithLeastDeductedPoints.each do |wr| addPoints(wr) @@ -174,10 +174,10 @@ class PoolOrder def mostMajors pointsArray = [] wrestlersWithSamePoints.each do |w| - pointsArray << w.majorWins.size + pointsArray << w.major_wins.size end mostPoints = pointsArray.max - wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.majorWins.size == mostPoints} + wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.major_wins.size == mostPoints} addPointsToWrestlersAhead(wrestlersWithLeastDeductedPoints.first) wrestlersWithLeastDeductedPoints.each do |wr| addPoints(wr) diff --git a/app/services/tournament_services/generate_tournament_matches.rb b/app/services/tournament_services/generate_tournament_matches.rb index 35fef43..9c19e12 100644 --- a/app/services/tournament_services/generate_tournament_matches.rb +++ b/app/services/tournament_services/generate_tournament_matches.rb @@ -53,7 +53,7 @@ class GenerateTournamentMatches end def moveFinalsMatchesToLastRound - finalsRound = @tournament.totalRounds + finalsRound = @tournament.total_rounds finalsMatches = @tournament.matches.reload.select{|m| m.bracket_position == "1/2" || m.bracket_position == "3/4" || m.bracket_position == "5/6" || m.bracket_position == "7/8"} finalsMatches. each do |m| m.round = finalsRound @@ -66,7 +66,7 @@ class GenerateTournamentMatches if matsToAssign.count > 0 until matsToAssign.sort_by{|m| m.id}.last.matches.count == 4 matsToAssign.sort_by{|m| m.id}.each do |m| - m.assignNextMatch + m.assign_next_match end end end diff --git a/app/services/tournament_services/pool_generation.rb b/app/services/tournament_services/pool_generation.rb index 12e3948..b2bbad2 100644 --- a/app/services/tournament_services/pool_generation.rb +++ b/app/services/tournament_services/pool_generation.rb @@ -15,9 +15,9 @@ class PoolGeneration end def roundRobin - wrestlers = @weight.wrestlersForPool(@pool) - poolMatches = RoundRobinTournament.schedule(wrestlers).reverse - poolMatches.each_with_index do |b, index| + wrestlers = @weight.wrestlers_in_pool(@pool) + pool_matches = RoundRobinTournament.schedule(wrestlers).reverse + pool_matches.each_with_index do |b, index| round = index + 1 bouts = b.map bouts.each do |bout| diff --git a/app/services/tournament_services/pool_to_bracket_match_generation.rb b/app/services/tournament_services/pool_to_bracket_match_generation.rb index a961895..74ef1d3 100644 --- a/app/services/tournament_services/pool_to_bracket_match_generation.rb +++ b/app/services/tournament_services/pool_to_bracket_match_generation.rb @@ -30,14 +30,14 @@ class PoolToBracketMatchGeneration def setOriginalSeedsToWrestleLastPoolRound(weight) pool = 1 until pool > weight.pools - wrestler1 = weight.poolSeedOrder(pool).first - wrestler2 = weight.poolSeedOrder(pool).second - match = wrestler1.poolMatches.sort_by{|m| m.round}.last + wrestler1 = weight.pool_wrestlers_sorted_by_bracket_line(pool).first + wrestler2 = weight.pool_wrestlers_sorted_by_bracket_line(pool).second + match = wrestler1.pool_matches.sort_by{|m| m.round}.last if match.w1 != wrestler2.id or match.w2 != wrestler2.id if match.w1 == wrestler1.id - SwapWrestlers.new.swapWrestlers(match.w2,wrestler2.id) + SwapWrestlers.new.swap_wrestlers_bracket_lines(match.w2,wrestler2.id) elsif match.w2 == wrestler1.id - SwapWrestlers.new.swapWrestlers(match.w1,wrestler2.id) + SwapWrestlers.new.swap_wrestlers_bracket_lines(match.w1,wrestler2.id) end end pool += 1 diff --git a/app/services/weight_services/generate_pool_numbers.rb b/app/services/weight_services/generate_pool_numbers.rb index c81e967..951bd6e 100644 --- a/app/services/weight_services/generate_pool_numbers.rb +++ b/app/services/weight_services/generate_pool_numbers.rb @@ -5,11 +5,11 @@ class GeneratePoolNumbers def savePoolNumbers if @weight.pools == 4 - saveFourPoolNumbers(@weight.wrestlersWithoutPool) + saveFourPoolNumbers(@weight.wrestlers_without_pool_assignment) elsif @weight.pools == 2 - saveTwoPoolNumbers(@weight.wrestlersWithoutPool) + saveTwoPoolNumbers(@weight.wrestlers_without_pool_assignment) elsif @weight.pools == 1 - saveOnePoolNumbers(@weight.wrestlersWithoutPool) + saveOnePoolNumbers(@weight.wrestlers_without_pool_assignment) end end diff --git a/app/services/wrestler_services/calculate_wrestler_team_score.rb b/app/services/wrestler_services/calculate_wrestler_team_score.rb index c15267b..59fbf5a 100644 --- a/app/services/wrestler_services/calculate_wrestler_team_score.rb +++ b/app/services/wrestler_services/calculate_wrestler_team_score.rb @@ -13,7 +13,7 @@ class CalculateWrestlerTeamScore end def earnedPoints - return poolPoints + bracketPoints + placementPoints + bonusWinPoints + byePoints + return poolPoints + bracketPoints + placement_points + bonusWinPoints + byePoints end def deductedPoints @@ -24,17 +24,17 @@ class CalculateWrestlerTeamScore points end - def placementPoints + def placement_points PoolBracketPlacementPoints.new(@wrestler).calcPoints if @tournament.tournament_type == "Pool to bracket" end def bracketPoints - (@wrestler.championshipAdvancementWins.size * 2) + (@wrestler.consoAdvancementWins.size * 1) + (@wrestler.championship_advancement_wins.size * 2) + (@wrestler.consolation_advancement_wins.size * 1) end def poolPoints if @tournament.tournament_type == "Pool to bracket" - (@wrestler.poolWins.size * 2) + (@wrestler.pool_wins.size * 2) else 0 end @@ -42,7 +42,7 @@ class CalculateWrestlerTeamScore def byePoints if @tournament.tournament_type == "Pool to bracket" - if @wrestler.poolWins.size >= 1 and @wrestler.hasAPoolBye == true + if @wrestler.pool_wins.size >= 1 and @wrestler.has_a_pool_bye == true 2 else 0 @@ -53,7 +53,7 @@ class CalculateWrestlerTeamScore end def bonusWinPoints - (@wrestler.pinWins.size * 2) + (@wrestler.techWins.size * 1.5) + (@wrestler.majorWins.size * 1) + (@wrestler.pin_wins.size * 2) + (@wrestler.tech_wins.size * 1.5) + (@wrestler.major_wins.size * 1) end end diff --git a/app/services/wrestler_services/pool_bracket_placement_points.rb b/app/services/wrestler_services/pool_bracket_placement_points.rb index c8d689c..da24f76 100644 --- a/app/services/wrestler_services/pool_bracket_placement_points.rb +++ b/app/services/wrestler_services/pool_bracket_placement_points.rb @@ -16,7 +16,7 @@ class PoolBracketPlacementPoints if @bracket == "fourPoolsToSemi" whilePointsAreZero { @points = fourPoolsToSemi } end - if @wrestler.weight.wrestlers.size <= 6 && @wrestler.weight.allPoolMatchesFinished(1) + if @wrestler.weight.wrestlers.size <= 6 && @wrestler.weight.all_pool_matches_finished(1) whilePointsAreZero { @points = onePool } end return @points @@ -29,11 +29,11 @@ class PoolBracketPlacementPoints end def bracket_position_size(bracket_position_name) - @wrestler.allMatches.select{|m| m.bracket_position == bracket_position_name}.size + @wrestler.all_matches.select{|m| m.bracket_position == bracket_position_name}.size end def won_bracket_position_size(bracket_position_name) - @wrestler.matchesWon.select{|m| m.bracket_position == bracket_position_name}.size + @wrestler.matches_won.select{|m| m.bracket_position == bracket_position_name}.size end def fourPoolsToQuarter @@ -67,14 +67,14 @@ class PoolBracketPlacementPoints end def onePool - poolOrder = @wrestler.weight.poolOrder(1) - if @wrestler == poolOrder.first + pool_placement_order = @wrestler.weight.pool_placement_order(1) + if @wrestler == pool_placement_order.first return firstPlace - elsif @wrestler == poolOrder.second + elsif @wrestler == pool_placement_order.second return secondPlace - elsif @wrestler == poolOrder.third + elsif @wrestler == pool_placement_order.third return thirdPlace - elsif @wrestler == poolOrder.fourth + elsif @wrestler == pool_placement_order.fourth return fourthPlace end return 0 diff --git a/app/services/wrestler_services/swap_wrestlers.rb b/app/services/wrestler_services/swap_wrestlers.rb index 788f6d4..81ab486 100644 --- a/app/services/wrestler_services/swap_wrestlers.rb +++ b/app/services/wrestler_services/swap_wrestlers.rb @@ -2,7 +2,7 @@ class SwapWrestlers attr_accessor :wrestler1_id, :wrestler2_id - def swapWrestlers(wrestler1_id,wrestler2_id) + def swap_wrestlers_bracket_lines(wrestler1_id,wrestler2_id) w1 = Wrestler.find(wrestler1_id) w2 = Wrestler.find(wrestler2_id) @@ -12,15 +12,15 @@ class SwapWrestlers w3.original_seed = w1.original_seed w3.bracket_line = w1.bracket_line w3.pool = w1.pool - swapWrestlerMatches(w1.allMatches,w1.id,w3.id) + swapWrestlerMatches(w1.all_matches,w1.id,w3.id) #Swap wrestler 1 and wrestler 2 - swapWrestlerMatches(w2.allMatches,w2.id,w1.id) + swapWrestlerMatches(w2.all_matches,w2.id,w1.id) w1.bracket_line = w2.bracket_line w1.pool = w2.pool - swapWrestlerMatches(w3.allMatches,w3.id,w2.id) + swapWrestlerMatches(w3.all_matches,w3.id,w2.id) w2.bracket_line = w3.bracket_line w2.pool = w3.pool diff --git a/app/views/api/tournament.jbuilder b/app/views/api/tournament.jbuilder index 1027761..c4aff85 100644 --- a/app/views/api/tournament.jbuilder +++ b/app/views/api/tournament.jbuilder @@ -20,7 +20,7 @@ json.cache! ["api_tournament", @tournament] do json.original_seed wrestler.original_seed json.criteria wrestler.criteria json.extra wrestler.extra - json.seasonWinPercentage wrestler.seasonWinPercentage + json.season_win_percentage wrestler.season_win_percentage json.season_win wrestler.season_win json.season_loss wrestler.season_loss end @@ -28,7 +28,7 @@ json.cache! ["api_tournament", @tournament] do json.mats @tournament.mats do |mat| json.name mat.name - json.unfinishedMatches mat.unfinishedMatches do |match| + json.unfinished_matches mat.unfinished_matches do |match| json.bout_number match.bout_number json.w1_name match.w1_name json.w2_name match.w2_name diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb index d5dd506..4b183c0 100644 --- a/app/views/matches/_form.html.erb +++ b/app/views/matches/_form.html.erb @@ -17,11 +17,11 @@ <%= @w1.name %>
Last Match: <%= if @w1.lastMatch != nil then time_ago_in_words(@w1.lastMatch.updated_at) end%> +
Last Match: <%= if @w1.last_match != nil then time_ago_in_words(@w1.last_match.updated_at) end%> <%= @w2.name %>
Last Match: <%= if @w2.lastMatch != nil then time_ago_in_words(@w2.lastMatch.updated_at) end%> +
Last Match: <%= if @w2.last_match != nil then time_ago_in_words(@w2.last_match.updated_at) end%> diff --git a/app/views/mats/_match_edit_form.html.erb b/app/views/mats/_match_edit_form.html.erb index 08dbcab..66ac5df 100644 --- a/app/views/mats/_match_edit_form.html.erb +++ b/app/views/mats/_match_edit_form.html.erb @@ -17,11 +17,11 @@ <%= @w1.name %> - <%= @w1.school.name %>
Last Match: <%= if @w1.lastMatch != nil then time_ago_in_words(@w1.lastMatch.updated_at) end%> +
Last Match: <%= if @w1.last_match != nil then time_ago_in_words(@w1.last_match.updated_at) end%> <%= @w2.name %> - <%= @w2.school.name %>
Last Match: <%= if @w2.lastMatch != nil then time_ago_in_words(@w2.lastMatch.updated_at) end%> +
Last Match: <%= if @w2.last_match != nil then time_ago_in_words(@w2.last_match.updated_at) end%> diff --git a/app/views/schools/show.html.erb b/app/views/schools/show.html.erb index 23118fc..2415bf3 100644 --- a/app/views/schools/show.html.erb +++ b/app/views/schools/show.html.erb @@ -13,7 +13,7 @@

Team Points Deducted: - <%= @school.totalDeductedPoints %> + <%= @school.total_points_deducted %>

Score: @@ -57,11 +57,11 @@ <%= wrestler.original_seed %> - <%= wrestler.totalTeamPoints - wrestler.totalDeductedPoints %> + <%= wrestler.total_team_points - wrestler.total_points_deducted %> <% if wrestler.extra? == true %> Yes <% end %> - <%= wrestler.nextMatchBoutNumber %> <%= wrestler.nextMatchMatName %> + <%= wrestler.next_match_bout_number %> <%= wrestler.next_match_mat_name %> <%= link_to 'Show', wrestler , :class=>"btn btn-default btn-sm" %> <% if can? :manage, wrestler.school %> diff --git a/app/views/schools/stats.html.erb b/app/views/schools/stats.html.erb index 1faac46..70bc93d 100644 --- a/app/views/schools/stats.html.erb +++ b/app/views/schools/stats.html.erb @@ -18,13 +18,13 @@ <% @school.wrestlers.each do |wrestler| %> - <% wrestler.allMatches.each do |m| %> + <% wrestler.all_matches.each do |m| %> <%= wrestler.name %> <%= m.bout_number %> <%= m.bracket_position %> <%= m.list_w1_stats %>
<%= m.list_w2_stats %> - <%= wrestler.resultByBout(m.bout_number) %> + <%= wrestler.result_by_bout(m.bout_number) %> <% end %> <% end %> diff --git a/app/views/tournaments/_fourPoolQuarterBracket.html.erb b/app/views/tournaments/_fourPoolQuarterBracket.html.erb index 4b07d9b..a3dacd0 100644 --- a/app/views/tournaments/_fourPoolQuarterBracket.html.erb +++ b/app/views/tournaments/_fourPoolQuarterBracket.html.erb @@ -5,7 +5,7 @@

  •  
  • <%= match.w1_name %>
  • -
  • <%= match.bout_number %> <%= match.bracketScore %> 
  • +
  • <%= match.bout_number %> <%= match.bracket_score_string %> 
  • <%= match.w2_name %>
  •  
  • @@ -17,7 +17,7 @@
  •  
  • <%= match.w1_name %>
  • -
  • <%= match.bout_number %> <%= match.bracketScore %> 
  • +
  • <%= match.bout_number %> <%= match.bracket_score_string %> 
  • <%= match.w2_name %>
  •  
  • @@ -28,7 +28,7 @@
  •  
  • <%= match.w1_name %>
  • -
  • <%= match.bout_number %> <%= match.bracketScore %> 
  • +
  • <%= match.bout_number %> <%= match.bracket_score_string %> 
  • <%= match.w2_name %>
  •  
  • @@ -37,7 +37,7 @@