-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be5e92b
commit 0228a86
Showing
3 changed files
with
40 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from .transaction_item import TransactionItem | ||
|
||
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['processDate'] | ||
self.bid_amount = data['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})' | ||
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,7 @@ | ||
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}' | ||