1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-12-03 16:24:20 +00:00

Custom strings

This commit is contained in:
Steffo 2018-12-18 19:28:27 +01:00
parent 3328ed7296
commit 0ab22f3340

12
db.py
View file

@ -334,6 +334,9 @@ class LeagueOfLegendsRanks(enum.Enum):
GRANDMASTER = 7
CHALLENGER = 8
def __str__(self):
return self.name.capitalize()
class RomanNumerals(enum.Enum):
I = 1
@ -341,6 +344,9 @@ class RomanNumerals(enum.Enum):
III = 3
IV = 4
def __str__(self):
return self.name
class LeagueOfLegends(Base):
__tablename__ = "leagueoflegends"
@ -414,6 +420,12 @@ class LeagueOfLegends(Base):
flex.value = (None, None) if flex_q is None else (LeagueOfLegendsRanks[flex_q["tier"]], RomanNumerals[flex_q["rank"]])
twtr.value = (None, None) if twtr_q is None else (LeagueOfLegendsRanks[twtr_q["tier"]], RomanNumerals[twtr_q["rank"]])
self.highest_mastery_champ = mastery[0]["championId"]
self.solo_division = solo.value[0]
self.solo_rank = solo.value[1]
self.flex_division = flex.value[0]
self.flex_rank = flex.value[1]
self.twtr_division = twtr.value[0]
self.twtr_rank = twtr.value[1]
return solo, flex, twtr
def highest_mastery_champ_name(self):