Corrected issue with the update records, if no entry yet
This commit is contained in:
parent
86018bc24d
commit
cfac889db8
|
@ -35,9 +35,7 @@ def user_battling(ctx, player2=None):
|
|||
def update_battle_records(winner, loser):
|
||||
# We're using the Harkness scale to rate
|
||||
# http://opnetchessclub.wikidot.com/harkness-rating-system
|
||||
battles = config.get_content('battle_records')
|
||||
if battles is None:
|
||||
battles = {winner.id: "1-0", loser.id: "0-1"}
|
||||
battles = config.get_content('battle_records') or {}
|
||||
|
||||
# Start ratings at 1000 if they have no rating
|
||||
winner_stats = battles.get(winner.id) or {}
|
||||
|
|
|
@ -101,9 +101,7 @@ class Board:
|
|||
def update_records(winner, loser):
|
||||
# This is the exact same formula as the battling update.
|
||||
# The only difference is I use the word "match" instead of "battle"
|
||||
matches = config.get_content('tictactoe')
|
||||
if matches is None:
|
||||
matches = {winner.id: "1-0", loser.id: "0-1"}
|
||||
matches = config.get_content('tictactoe') or {}
|
||||
|
||||
winner_stats = matches.get(winner.id) or {}
|
||||
winner_rating = winner_stats.get('rating') or 1000
|
||||
|
|
Loading…
Reference in a new issue