Skip to content

Commit

Permalink
Merge pull request #361 from cwendt94/player_ownership_fb
Browse files Browse the repository at this point in the history
FB Add Player Ownership
  • Loading branch information
cwendt94 authored Sep 16, 2022
2 parents 3bffd8b + 07bf73f commit f7239c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions espn_api/football/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def __init__(self, data, year):
player = data['playerPoolEntry']['player'] if 'playerPoolEntry' in data else data['player']
self.injuryStatus = player.get('injuryStatus', self.injuryStatus)
self.injured = player.get('injured', False)
self.percent_owned = round(player.get('ownership', {}).get('percentOwned', -1), 2)
self.percent_started = round(player.get('ownership', {}).get('percentStarted', -1), 2)

player_stats = player.get('stats', [])
for stats in player_stats:
Expand Down
2 changes: 2 additions & 0 deletions tests/football/unit/test_league.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ def test_player_info(self, m):
player = league.player_info('James Conner')
self.assertEqual(player.name, 'James Conner')
self.assertEqual(player.stats[1]['points'], 10.5)
self.assertEqual(player.percent_owned, 96.73)
self.assertEqual(player.percent_started, 73.87)



0 comments on commit f7239c0

Please sign in to comment.