-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #598 from simonbilskyrollins/transactions
Basketball League Transactions
- Loading branch information
Showing
3 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class Transaction(object): | ||
def __init__(self, data, player_map, get_team_data): | ||
self.team = get_team_data(data['teamId']) | ||
self.type = data['type'] | ||
self.status = data['status'] | ||
self.scoring_period = data['scoringPeriodId'] | ||
self.date = data.get('processDate') | ||
self.bid_amount = data.get('bidAmount') | ||
self.items = [] | ||
for item in data['items']: | ||
self.items.append(TransactionItem(item, player_map)) | ||
|
||
def __repr__(self): | ||
items = ', '.join([str(item) for item in self.items]) | ||
return f'Transaction({self.team.team_name} {self.type} {items})' | ||
|
||
class TransactionItem(object): | ||
def __init__(self, data, player_map): | ||
self.type = data['type'] | ||
self.player = player_map[data['playerId']] | ||
|
||
def __repr__(self): | ||
return f'{self.type} {self.player}' |