Skip to content

Commit

Permalink
bugfix on position & lineupSlot mapping
Browse files Browse the repository at this point in the history
Check for None type on position & lineupSlot parsing
  • Loading branch information
samthom1 authored Nov 21, 2023
1 parent 0bfd824 commit b9a15c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions espn_api/hockey/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def __init__(self, data):
self.name = json_parsing(data, 'fullName')
self.playerId = json_parsing(data, 'id')
self.position = POSITION_MAP.get(json_parsing(data, 'defaultPositionId')
if json_parsing(data, 'defaultPositionId')>3
if json_parsing(data, 'defaultPositionId') and json_parsing(data, 'defaultPositionId') > 3
else json_parsing(data, 'defaultPositionId')-1, '')
self.lineupSlot = POSITION_MAP.get(data.get('lineupSlotId')
if data.get('lineupSlotId')>3
if data.get('lineupSlotId') and data.get('lineupSlotId') > 3
else data.get('lineupSlotId')-1, '')
self.eligibleSlots = [POSITION_MAP.get(pos, '') for pos in json_parsing(data, 'eligibleSlots')]
self.acquisitionType = json_parsing(data, 'acquisitionType')
Expand Down

0 comments on commit b9a15c4

Please sign in to comment.