diff --git a/home/templates/home/user_profile.html b/home/templates/home/user_profile.html index 6880abf..4217aab 100644 --- a/home/templates/home/user_profile.html +++ b/home/templates/home/user_profile.html @@ -17,35 +17,36 @@
{{user.username}}#{{user.discriminator}}
-{% if elos|length > 0 %} - -
-
-

Ranked

-
- - {% for elo in elos %} -
-
-

- {{elo.game_mode}} -

-
{{elo.elo|floatformat:1}}
-
- {{elo.matches_won}}-{{elo.matches_lost}}-{{elo.matches_drawn}} -
+{% if elos_by_game %} +
+
+

Ranked Games

+ + + + + + + + + + + {% for game_mode, elo in elos_by_game.items %} + + + + {% if elo %} + + + {% else %} + + {% endif %} + + {% endfor %} + +
GameModeELOW-L-T
{{ game_mode.game }}{{ game_mode.name }}{{ elo.elo|floatformat:1 }}{{ elo.matches_won }}-{{ elo.matches_lost }}-{{ elo.matches_drawn }}Not Played
- {% endfor %} -
{% endif %}
@@ -56,59 +57,58 @@

Highscores

-{% if games|length > 0 %} {% for game_name, game in games.items %} - -
-
-

- {{game_name}} 0 %} + {% for game_name, game in games.items %} +
+
-

-

{{game.overall}}

-
- - {% for score in game.scores %} +

+ {{game_name}} +

+

{{game.overall}}

+
-
-
-

- {{score.leaderboard.name}} -

-

{{score.score}}

- {% if score.score > 0 %} - - {% if "youtube" in score.source or "streamable" in sources.source %} - - {% else %} - {% if "https://i.imgur.com/bUUfB8c.png" not in score.source %} - {{score.leaderboard.name}} score screenshot - {% endif %} - {% endif %} {% endif %} + {% for score in game.scores %} +
+
+

+ {{score.leaderboard.name}} +

+

{{score.score}}

+ {% if score.score > 0 %} + {% if "youtube" in score.source or "streamable" in score.source %} + + {% else %} + {% if "https://i.imgur.com/bUUfB8c.png" not in score.source %} + {{score.leaderboard.name}} score screenshot + {% endif %} + {% endif %} + {% endif %} +
+
+ {% endfor %}
-
- {% endfor %} -
- -{% endfor %} {% endif %} {% endblock %} +{% endif %} +{% endblock %} diff --git a/home/views.py b/home/views.py index 83e3af5..d5dd0a1 100644 --- a/home/views.py +++ b/home/views.py @@ -1,4 +1,4 @@ -from ranked.models import PlayerElo +from ranked.models import PlayerElo, GameMode from .models import HistoricEvent, Staff from django.http.response import HttpResponseRedirect from discordoauth2.models import User @@ -113,9 +113,14 @@ def user_profile(request, user_id: int): games[score.leaderboard.game]["scores"] += [score] games[score.leaderboard.game]["overall"] += score.score + all_game_modes = GameMode.objects.all() player_elos = PlayerElo.objects.filter(player=user) + + elos_by_game = {} + for game_mode in all_game_modes: + elos_by_game[game_mode] = player_elos.filter(game_mode=game_mode).first() - context = {"games": games, "user": user, "elos": player_elos} + context = {"games": games, "user": user, "elos_by_game": elos_by_game} return render(request, "home/user_profile.html", context)