Module: CalculateStats

Included in:
ESPNNBAFantasy::Player, ESPNNBAFantasy::Team
Defined in:
lib/espn_nba_fantasy/calculate_stats.rb

Overview

this is a module used to calculate the AFG%, A/TO, and FT% stats based on existing raw stats

Instance Method Summary collapse

Instance Method Details

#add_calculated_stats(stats) ⇒ Object



5
6
7
8
9
10
# File 'lib/espn_nba_fantasy/calculate_stats.rb', line 5

def add_calculated_stats(stats)
  stats['AFG%'] = (stats['3PTM']*0.5+stats['FGM'])/(stats['FGA'])
  stats['A/TO'] = stats['AST']/(stats['TO'])
  stats['FT%'] = stats['FTM']/(stats['FTA'])
  stats
end