diff --git a/db.py b/db.py
index 0cb41a73..73023507 100644
--- a/db.py
+++ b/db.py
@@ -701,6 +701,18 @@ class Discord(Base, Mini):
return "https://discordapp.com/assets/6debd47ed13483642cf09e832ed0bc1b.png"
return f"https://cdn.discordapp.com/avatars/{self.discord_id}/{self.avatar_hex}.png?size={size}"
+ @classmethod
+ def mini_get_all(cls, session: Session):
+ return [dict(row) for row in session.execute(query_discord_music.all_query)]
+
+ @classmethod
+ def mini_get_single(cls, session: Session, **kwargs):
+ return session.execute(query_discord_music.one_query, {"royal": kwargs["royal"].id}).fetchone()
+
+ @classmethod
+ def mini_get_single_from_royal(cls, session: Session, royal: "Royal"):
+ return cls.mini_get_single(session, royal=royal)
+
class Overwatch(Base, Mini):
__tablename__ = "overwatch"
diff --git a/templates/game.html b/templates/game.html
index e23c6ab1..00b3faf7 100644
--- a/templates/game.html
+++ b/templates/game.html
@@ -16,7 +16,7 @@
{% for record in mini_data %}
- {% include "minis/" + record._mini_name + ".html" %}
+ {% include "minis/" + mini_type._mini_name + ".html" %}
{% endfor %}
diff --git a/templates/profile.html b/templates/profile.html
index 1d91953e..04d15f24 100644
--- a/templates/profile.html
+++ b/templates/profile.html
@@ -35,8 +35,10 @@
{% endif %}
- {% for record in mini_data %}
- {% include "minis/" + record._mini_name + ".html" %}
+ {% for mini in mini_data %}
+ {% with record = mini["data"] %}
+ {% include "minis/" + mini["name"] + ".html" %}
+ {% endwith %}
{% endfor %}
diff --git a/webserver.py b/webserver.py
index e6c5c6c5..fe884e77 100644
--- a/webserver.py
+++ b/webserver.py
@@ -118,9 +118,15 @@ def page_profile(name: str):
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])
+ mini_data.append({
+ "name": game._mini_name,
+ "data": data[0]
+ })
continue
- mini_data.append(data)
+ mini_data.append({
+ "name": game._mini_name,
+ "data": data
+ })
if css is not None:
converted_bio = Markup(markdown2.markdown(css.bio.replace("<", "<"),
extras=["spoiler", "tables", "smarty-pants", "fenced-code-blocks"]))