diff --git a/templates/minis/discord.html b/templates/minis/discord.html index 655d3277..23f073b9 100644 --- a/templates/minis/discord.html +++ b/templates/minis/discord.html @@ -25,7 +25,7 @@ {% if record["fav_song"] %}
Canzone preferita
- {{ record["fav_song"] }} + {{ record["fav_song"] }}
{{ record["max_plays"] }}x
{% else %} diff --git a/webserver.py b/webserver.py index 1cf43e45..fee1b6fa 100644 --- a/webserver.py +++ b/webserver.py @@ -342,20 +342,15 @@ def page_music(): return render_template("topsongs.html", songs=songs) -@app.route("/music/") -def page_music_individual(name: str): +@app.route("/music/") +def page_music_individual(discord_id: str): db_session = db.Session() - user = db_session.query(db.Royal).filter_by(username=name).one_or_none() - if user is None: - db_session.close() - abort(404) - return - discord = db_session.query(db.Discord).filter_by(royal=user).one_or_none() + discord = db_session.query(db.Discord).filter_by(discord_id=discord_id).one_or_none() if discord is None: db_session.close() abort(404) return - songs = db_session.execute(query_discord_music.single_top_songs, {"discordid": discord.id}) + songs = db_session.execute(query_discord_music.single_top_songs, {"discordid": discord.discord_id}) db_session.close() return render_template("topsongs.html", songs=songs, discord=discord)