mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-10 23:53:06 +00:00
Fixed pool order by only getting team points from pool wins and fixing calculating pin time
This commit is contained in:
@@ -111,7 +111,7 @@ class Match < ApplicationRecord
|
|||||||
sec = time.partition(':').last.to_i
|
sec = time.partition(':').last.to_i
|
||||||
return minutes_in_seconds + sec
|
return minutes_in_seconds + sec
|
||||||
else
|
else
|
||||||
nil
|
0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Wrestler < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def total_pool_points_for_pool_order
|
def total_pool_points_for_pool_order
|
||||||
CalculateWrestlerTeamScore.new(self).poolPoints + CalculateWrestlerTeamScore.new(self).bonusWinPoints
|
CalculateWrestlerTeamScore.new(self).poolPoints + CalculateWrestlerTeamScore.new(self).pool_bonus_points
|
||||||
end
|
end
|
||||||
|
|
||||||
def unfinished_pool_matches
|
def unfinished_pool_matches
|
||||||
@@ -260,6 +260,7 @@ class Wrestler < ApplicationRecord
|
|||||||
def pin_time_pool
|
def pin_time_pool
|
||||||
time = 0
|
time = 0
|
||||||
pin_wins.select{|m| m.bracket_position == "Pool"}.each do | m |
|
pin_wins.select{|m| m.bracket_position == "Pool"}.each do | m |
|
||||||
|
puts m.pin_time_in_seconds
|
||||||
time = time + m.pin_time_in_seconds
|
time = time + m.pin_time_in_seconds
|
||||||
end
|
end
|
||||||
time
|
time
|
||||||
|
|||||||
@@ -43,6 +43,14 @@ class CalculateWrestlerTeamScore
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pool_bonus_points
|
||||||
|
if @tournament.tournament_type == "Pool to bracket"
|
||||||
|
(@wrestler.pin_wins.select{|m| m.bracket_position == "Pool"}.size * 2) + (@wrestler.tech_wins.select{|m| m.bracket_position == "Pool"}.size * 1.5) + (@wrestler.major_wins.select{|m| m.bracket_position == "Pool"}.size * 1)
|
||||||
|
else
|
||||||
|
0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def byePoints
|
def byePoints
|
||||||
points = 0
|
points = 0
|
||||||
if @tournament.tournament_type == "Pool to bracket"
|
if @tournament.tournament_type == "Pool to bracket"
|
||||||
|
|||||||
Reference in New Issue
Block a user