Class: YFantasy::Matchup
Instance Method Summary
collapse
dependent?, find, resource_name
included
Instance Method Details
#loser_proj_points ⇒ Object
46
47
48
|
# File 'lib/y_fantasy/resources/shared_subresources/matchup.rb', line 46
def loser_proj_points
losing_team&.stats&.team_projected_points&.total
end
|
#loser_total_points ⇒ Object
42
43
44
|
# File 'lib/y_fantasy/resources/shared_subresources/matchup.rb', line 42
def loser_total_points
losing_team&.stats&.team_points&.total
end
|
#losing_team ⇒ Object
28
29
30
31
32
|
# File 'lib/y_fantasy/resources/shared_subresources/matchup.rb', line 28
def losing_team
return if is_tied
teams.find { |team| team.team_key != winner_team_key }
end
|
#scores ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/y_fantasy/resources/shared_subresources/matchup.rb', line 50
def scores
teams.map do |team|
{
team_key: team.team_key,
team_name: team.name,
total: team.stats.team_points.total,
proj_total: team.stats.team_projected_points.total
}
end
end
|
#winner_proj_points ⇒ Object
38
39
40
|
# File 'lib/y_fantasy/resources/shared_subresources/matchup.rb', line 38
def winner_proj_points
winning_team&.stats&.team_projected_points&.total
end
|
#winner_total_points ⇒ Object
34
35
36
|
# File 'lib/y_fantasy/resources/shared_subresources/matchup.rb', line 34
def winner_total_points
winning_team&.stats&.team_points&.total
end
|
#winning_team ⇒ Object
22
23
24
25
26
|
# File 'lib/y_fantasy/resources/shared_subresources/matchup.rb', line 22
def winning_team
return if is_tied
teams.find { |team| team.team_key == winner_team_key }
end
|