1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-07 06:54:16 +00:00

Pool order tests are not asserting properly and once fixed some were failing. All tests fixed and passing now.

This commit is contained in:
2023-01-23 22:14:00 +00:00
parent 1ee886abd3
commit 1d0cff0e6f
4 changed files with 427 additions and 324 deletions

View File

@@ -226,9 +226,28 @@ class Wrestler < ActiveRecord::Base
points_scored
end
def decision_points_scored_pool
points_scored = 0
decision_wins.select{|m| m.bracket_position == "Pool"}.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
points_scored
end
def fastest_pin
pin_wins.sort_by{|m| m.pin_time_in_seconds}.first
end
def fastest_pin_pool
pin_wins.select{|m| m.bracket_position == "Pool"}.sort_by{|m| m.pin_time_in_seconds}.first
end
def pin_time
time = 0
@@ -238,6 +257,14 @@ class Wrestler < ActiveRecord::Base
time
end
def pin_time_pool
time = 0
pin_wins.select{|m| m.bracket_position == "Pool"}.each do | m |
time = time + m.pin_time_in_seconds
end
time
end
def season_win_percentage
win = self.season_win.to_f
loss = self.season_loss.to_f