Update transactions.py

Updated tiebreaker calc for transactions involving free agency
This commit is contained in:
Cal Corum 2023-08-19 01:05:10 -05:00
parent 46948eaa83
commit 611d2ea075

View File

@ -469,11 +469,15 @@ class Transactions(commands.Cog):
else:
new_team = move['newteam']
# team_record = await get_team_record(new_team, week_num=current["week"])
r_query = await db_get('standings', params=[
('season', current['season']), ('team_id', new_team['id'])
])
win_pct = r_query['standings'][0]['wins'] / (
r_query['standings'][0]['wins'] + r_query['standings'][0]['losses'])
if new_team['abbrev'] == 'FA':
win_pct = 0
else:
r_query = await db_get('standings', params=[
('season', current['season']), ('team_id', new_team['id'])
])
win_pct = r_query['standings'][0]['wins'] / (
r_query['standings'][0]['wins'] + r_query['standings'][0]['losses'])
tiebreaker = win_pct + (random.randint(10000, 99999) * .00000001)
if move["player"]["name"] not in added_players.keys():