1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Sped up tests and updated Pool Order

This commit is contained in:
2016-05-07 02:06:11 +00:00
parent 3659597780
commit a763c966d1
5 changed files with 1809 additions and 1726 deletions

View File

@@ -109,21 +109,26 @@ class PoolOrder
end
def fastestPin
timeArray = []
wrestlersWithSamePoints.each do |w|
timeArray << w.fastestPin
wrestlersWithSamePointsWithPins = []
wrestlersWithSamePoints.each do |wr|
if wr.pinWins.size > 0
wrestlersWithSamePointsWithPins << wr
end
end
fastest = timeArray.max
wrestlersWithFastestPin = wrestlersWithSamePoints.select{|w| w.fastestPin == fastest}
addPointsToWrestlersAhead(wrestlersWithFastestPin.first)
wrestlersWithFastestPin.each do |wr|
addPoints(wr)
end
secondFastest = timeArray.sort[-2]
wrestlersWithSecondFastestPin = wrestlersWithSamePoints.select{|w| w.fastestPin == secondFastest}
addPointsToWrestlersAhead(wrestlersWithSecondFastestPin.first)
wrestlersWithSecondFastestPin.each do |wr|
addPoints(wr)
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}
addPointsToWrestlersAhead(wrestlersWithFastestPin.first)
wrestlersWithFastestPin.each do |wr|
addPoints(wr)
end
wrestlersWithSecondFastestPin = wrestlersWithSamePointsWithPins.select{|w| w.fastestPin.pinTime == secondFastest.pinTime}
addPointsToWrestlersAhead(wrestlersWithSecondFastestPin.first)
wrestlersWithSecondFastestPin.each do |wr|
addPoints(wr)
end
end
end