Skip to content

Commit

Permalink
Merge pull request #502 from DesiPilla/add-active-status-to-player
Browse files Browse the repository at this point in the history
feat: Add active status to `Player`
  • Loading branch information
cwendt94 authored Dec 1, 2023
2 parents 96b4e31 + 3c00fdc commit 5a3bc2e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions espn_api/football/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self, data, year):
self.percent_owned = round(player.get('ownership', {}).get('percentOwned', -1), 2)
self.percent_started = round(player.get('ownership', {}).get('percentStarted', -1), 2)

self.active_status = 'bye'
player_stats = player.get('stats', [])
for stats in player_stats:
if stats.get('seasonId') != year:
Expand All @@ -44,6 +45,11 @@ def __init__(self, data, year):
self.stats[scoring_period][avg_type] = avg_points
else:
self.stats[scoring_period] = {points_type: points, breakdown_type: breakdown, avg_type: avg_points}
if not stat_source:
if not self.stats[scoring_period][breakdown_type]:
self.active_status = 'inactive'
else:
self.active_status = 'active'
self.total_points = self.stats.get(0, {}).get('points', 0)
self.projected_total_points = self.stats.get(0, {}).get('projected_points', 0)
self.avg_points = self.stats.get(0, {}).get('avg_points', 0)
Expand Down

0 comments on commit 5a3bc2e

Please sign in to comment.