Class: YFantasy::Matchup

Inherits:
BaseSubresource show all
Defined in:
lib/y_fantasy/resources/shared_subresources/matchup.rb

Instance Method Summary collapse

Methods inherited from BaseSubresource

dependent?, find, resource_name

Methods included from Subresourceable

included

Instance Method Details

#loser_proj_pointsObject



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_pointsObject



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_teamObject



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

#scoresObject



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_pointsObject



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_pointsObject



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_teamObject



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