From 611d2ea0755bdef83be811dc44679151afe50c2e Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sat, 19 Aug 2023 01:05:10 -0500 Subject: [PATCH] Update transactions.py Updated tiebreaker calc for transactions involving free agency --- cogs/transactions.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cogs/transactions.py b/cogs/transactions.py index a386ca9..35dd8c3 100644 --- a/cogs/transactions.py +++ b/cogs/transactions.py @@ -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():