{% extends 'Game/index.html.twig' %} {% block title %} - Profile{% endblock %} {% block body %}
{{ app.user.username|slice(0, 2)|upper }}

{{ app.user.username }}

{% if app.user.email %}

{{ app.user.email }}

{% endif %}

Registered commander

{{ stats.total }} Games played
{{ stats.wins }} Victories
{{ stats.losses }} Defeats
{{ stats.bombs }} Mines hit
Security Settings
{% if recent|length > 0 %}

Recent battles

{% for game in recent %} {% set is_red = game.red and game.red.id == app.user.id %} {% set my_points = is_red ? game.redPoints : game.bluePoints %} {% set opp_points = is_red ? game.bluePoints : game.redPoints %} {% set opp = is_red ? game.blue : game.red %} {% set opp_anon = is_red ? game.blueAnon : game.redAnon %} {% set result = 'draw' %} {% if game.resign == (is_red ? 'red' : 'blue') %} {% set result = 'loss' %} {% elseif game.resign == (is_red ? 'blue' : 'red') %} {% set result = 'win' %} {% elseif my_points is not null and opp_points is not null %} {% if my_points > opp_points %} {% set result = 'win' %} {% elseif my_points < opp_points %} {% set result = 'loss' %} {% endif %} {% endif %}
{{ result == 'win' ? 'W' : (result == 'loss' ? 'L' : 'D') }} {{ my_points ?? '—' }} : {{ opp_points ?? '—' }} vs {% if opp %} {{ opp.username }} {% elseif opp_anon %} {{ opp_anon.userName }} {% else %} Guest {% endif %} {{ game.updated ? game.updated|date('Y-m-d') : '' }}
{% endfor %}
{% else %}

No games recorded yet. Start playing!

{% endif %}
{% endblock %}