1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Everything but discord works fine now

This commit is contained in:
Steffo 2019-01-09 17:07:35 +01:00
parent 6e63ec6716
commit 5c7401af47
2 changed files with 11 additions and 4 deletions

7
db.py
View file

@ -101,12 +101,13 @@ class Mini(object):
def mini_get_single_from_royal(cls, session: Session, royal: "Royal"):
chain = relationship_link_chain(cls, Royal)
if chain is None:
chain = []
chain = tuple()
start = session.query(cls)
for connection in chain:
start = start.join(connection.mapper.class_)
start = start.filter(Royal.id == royal.id)
return start.one()
mini = start.one()
return mini
class Royal(Base, Mini):
@ -1185,7 +1186,7 @@ class Terraria13(Base, Mini):
return f"<Terraria13 {self.character_name} {self.contribution}>"
mini_list = [Royal, Telegram, Steam, RocketLeague, Dota, LeagueOfLegends, Osu, Discord, Overwatch, Halloween,
mini_list = [Royal, Telegram, Steam, Dota, LeagueOfLegends, Osu, Discord, Overwatch, Halloween,
Terraria13]

View file

@ -13,6 +13,7 @@ import query_discord_music
import random
import re
import functools
from sqlalchemy.orm.collections import InstrumentedList
from raven.contrib.flask import Sentry
app = Flask(__name__)
@ -114,7 +115,12 @@ def page_profile(name: str):
css = fl_g.session.query(db.ProfileData).filter_by(royal=user).one_or_none()
mini_data = []
for game in db.mini_list:
mini_data.append(game.mini_get_single_from_royal(fl_g.session, user))
data = game.mini_get_single_from_royal(fl_g.session, user)
# TODO: investigate on why instrumentedlists are returned
if isinstance(data, InstrumentedList):
mini_data.append(data[0])
continue
mini_data.append(data)
if css is not None:
converted_bio = Markup(markdown2.markdown(css.bio.replace("<", "&lt;"),
extras=["spoiler", "tables", "smarty-pants", "fenced-code-blocks"]))