Skip to content

Commit

Permalink
Merge pull request #1 from Erik-Lamers1/fix-None-type-in_get_ranking
Browse files Browse the repository at this point in the history
Fix none type in get_ranking
  • Loading branch information
Erik-Lamers1 authored Feb 5, 2021
2 parents d51a4da + 8ff415a commit c1fbc1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions os3_rll/discord/announcements/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from tabulate import tabulate

from os3_rll.discord.utils import create_embed, get_player
from os3_rll.models.player import PlayerException

logger = getLogger(__name__)

Expand All @@ -18,16 +17,13 @@ def announce_rankings(ranks: dict):
champion = next(iter(sorted_ranks.values()))[1]
description = ""

for k, v in sorted_ranks.items():
if get_player(k.name + "#" + str(k.discriminator)) is None:
raise PlayerException("Player returned from database does not have a valid Discord account")

for v in sorted_ranks.values():
description += "{0:2}. {1}\n".format(v[0], v[1])

try:
embed = {
"title": "**{} is the current champion.**".format(champion),
"description": "{}".format(description),
"description": description,
"footer": "Become the best!",
"colour": 2234352,
}
Expand All @@ -49,7 +45,7 @@ def announce_stats(stats: dict):
return:
Dictionary with content, title, description, footer and colour as keys.
"""
# Frist, sort the dict by rank
# First, sort the dict by rank
order = sorted(stats, key=lambda x: (stats[x]["rank"]))
table = []
header = ["Name", "Rank", "Wins", "Losses", "Challenged", "Avg_goals/pc"]
Expand Down Expand Up @@ -89,9 +85,8 @@ def announce_new_player(player):
return:
Dictionary with content, title, description, footer and colour as keys.
"""
description = (
"{p.discord} has entered the rocket league competition, "
+ "be sure to add their gamertag ({p.gamertag}) to your friend list!".format(p=player)
description = "{} has entered the rocket league competition, be sure to add their gamertag ({}) to your friend list!".format(
player.discord, player.gamertag
)
try:
embed = {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from setuptools import setup, find_packages

VERSION = "0.3.2"
VERSION = "0.3.3"

# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
Expand Down

0 comments on commit c1fbc1f

Please sign in to comment.