Skip to content

Commit

Permalink
feature: add box player changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benlawson committed Aug 8, 2020
1 parent 70b9795 commit b59ec5f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions espn_api/football/box_player.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .constant import POSITION_MAP, PRO_TEAM_MAP
from .constant import POSITION_MAP, PRO_TEAM_MAP, PLAYER_STATS_MAP
from .player import Player
from datetime import datetime, timedelta

Expand Down Expand Up @@ -30,9 +30,12 @@ def __init__(self, data, pro_schedule, positional_rankings, week):
for stats in player_stats:
if stats['statSourceId'] == 0 and stats['scoringPeriodId'] == week:
self.points = round(stats['appliedTotal'], 2)
self.points_breakdown = {PLAYER_STATS_MAP.get(int(k), k):v for (k,v) in stats['appliedStats'].items()}
elif stats['statSourceId'] == 1 and stats['scoringPeriodId'] == week:
self.projected_points = round(stats['appliedTotal'], 2)


self.projected_breakdown = {PLAYER_STATS_MAP.get(int(k), k):v for (k,v) in stats['appliedStats'].items()}



def __repr__(self):
return 'Player(%s, points:%d, projected:%d)' % (self.name, self.points, self.projected_points)

0 comments on commit b59ec5f

Please sign in to comment.