mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-05 06:07:20 +00:00
Tie breaker for team score
This commit is contained in:
@@ -45,6 +45,7 @@ class Poolorder
|
||||
ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { headToHead }
|
||||
end
|
||||
ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { deductedPoints }
|
||||
ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { teamPoints }
|
||||
ifWrestlersWithSamePointsIsSameAsOriginal(originalTieSize) { coinFlip }
|
||||
end
|
||||
|
||||
@@ -83,6 +84,19 @@ class Poolorder
|
||||
end
|
||||
end
|
||||
|
||||
def teamPoints
|
||||
pointsArray = []
|
||||
wrestlersWithSamePoints.each do |w|
|
||||
pointsArray << w.totalTeamPoints
|
||||
end
|
||||
mostPoints = pointsArray.max
|
||||
wrestlersWithLeastDeductedPoints = wrestlersWithSamePoints.select{|w| w.totalTeamPoints == mostPoints}
|
||||
addPointsToWrestlersAhead(wrestlersWithLeastDeductedPoints.first)
|
||||
wrestlersWithLeastDeductedPoints.each do |wr|
|
||||
addPoints(wr)
|
||||
end
|
||||
end
|
||||
|
||||
def coinFlip
|
||||
wrestler = wrestlersWithSamePoints.sample
|
||||
addPointsToWrestlersAhead(wrestler)
|
||||
|
||||
Reference in New Issue
Block a user