mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-30 15:04:18 +00:00
Everything but discord works fine now
This commit is contained in:
parent
6e63ec6716
commit
5c7401af47
2 changed files with 11 additions and 4 deletions
7
db.py
7
db.py
|
@ -101,12 +101,13 @@ class Mini(object):
|
||||||
def mini_get_single_from_royal(cls, session: Session, royal: "Royal"):
|
def mini_get_single_from_royal(cls, session: Session, royal: "Royal"):
|
||||||
chain = relationship_link_chain(cls, Royal)
|
chain = relationship_link_chain(cls, Royal)
|
||||||
if chain is None:
|
if chain is None:
|
||||||
chain = []
|
chain = tuple()
|
||||||
start = session.query(cls)
|
start = session.query(cls)
|
||||||
for connection in chain:
|
for connection in chain:
|
||||||
start = start.join(connection.mapper.class_)
|
start = start.join(connection.mapper.class_)
|
||||||
start = start.filter(Royal.id == royal.id)
|
start = start.filter(Royal.id == royal.id)
|
||||||
return start.one()
|
mini = start.one()
|
||||||
|
return mini
|
||||||
|
|
||||||
|
|
||||||
class Royal(Base, Mini):
|
class Royal(Base, Mini):
|
||||||
|
@ -1185,7 +1186,7 @@ class Terraria13(Base, Mini):
|
||||||
return f"<Terraria13 {self.character_name} {self.contribution}>"
|
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]
|
Terraria13]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import query_discord_music
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import functools
|
import functools
|
||||||
|
from sqlalchemy.orm.collections import InstrumentedList
|
||||||
from raven.contrib.flask import Sentry
|
from raven.contrib.flask import Sentry
|
||||||
|
|
||||||
app = Flask(__name__)
|
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()
|
css = fl_g.session.query(db.ProfileData).filter_by(royal=user).one_or_none()
|
||||||
mini_data = []
|
mini_data = []
|
||||||
for game in db.mini_list:
|
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:
|
if css is not None:
|
||||||
converted_bio = Markup(markdown2.markdown(css.bio.replace("<", "<"),
|
converted_bio = Markup(markdown2.markdown(css.bio.replace("<", "<"),
|
||||||
extras=["spoiler", "tables", "smarty-pants", "fenced-code-blocks"]))
|
extras=["spoiler", "tables", "smarty-pants", "fenced-code-blocks"]))
|
||||||
|
|
Loading…
Reference in a new issue