Final update to legality check

This commit is contained in:
Cal Corum 2023-07-31 16:17:28 -05:00
parent d32f319043
commit f0421a19de

View File

@ -140,9 +140,8 @@ class SBaTransaction:
mil_wara = 0
this_team = self.teams[team]['team']
# team_roster = await get_players(self.current['season'], this_team['abbrev'])
mil_team = await get_team_by_abbrev(f'{this_team["abbrev"]}MiL', season=this_team['season'])
t_query = await db_get('players', params=[
('season', self.current['season']), ('team_id', mil_team['id'])
('season', self.current['season']), ('team_id', this_team['id'])
])
team_roster = t_query['players']
@ -150,8 +149,9 @@ class SBaTransaction:
('season', self.current['season']), ('team_abbrev', f'{this_team["abbrev"]}MiL')
])
# mil_roster = await get_players(self.current['season'], f'{this_team["abbrev"]}MiL')
mil_team = await get_team_by_abbrev(f'{this_team["abbrev"]}MiL', season=this_team['season'])
m_query = await db_get('players', params=[
('season', self.current['season']), ('team_abbrev', f'{this_team["abbrev"]}MiL')
('season', self.current['season']), ('team_id', mil_team['id'])
])
mil_roster = m_query['players']
@ -219,7 +219,7 @@ class SBaTransaction:
# If player is leaving this team next week, remove from roster and subtract WARa
if self.players[x]['player']['team'] == this_team:
logging.info(f'major league player')
logging.info(f'team roster: {team_roster}')
# logging.info(f'team roster: {team_roster}')
team_roster.remove(self.players[x]['player'])
# 06-13: COMMENTED OUT TO RESOLVE MID-WEEK IL REPLACEMENT BEING SENT BACK DOWN
# if self.effective_week != self.current['week']:
@ -229,7 +229,7 @@ class SBaTransaction:
if self.players[x]['player']['team']['abbrev'] == f'{this_team["abbrev"]}MiL':
logging.info(f'minor league player')
mil_roster.remove(self.players[x]['player'])
logging.info(f'mil roster: {mil_roster}')
# logging.info(f'mil roster: {mil_roster}')
if self.effective_week != self.current['week']:
mil_wara -= self.players[x]['player']['wara']