<commit_before>{% trans_default_domain 'game_updates' %}
<div class="game-updates">
    {% set lastDate = null %}
    {% for update in updates %}
        {% set formattedDate = update.dateCreated|localizeddate('long', 'none') %}
        {% if lastDate != formattedDate %}
            <div class="date-header">{{ formattedDate }}:</div>
            {% set lastDate = formattedDate %}
        {% endif %}
        {# New Player message#}
        {% if update.type == 'new.player' %}
            {% set icon %}
                <img src="{{ update.parameters['player_picture'] }}" />
            {% endset %}
            {% set content %}
                <h4>{{ update.title|trans(update.parameters) }}</h4>
                <p>.. {{ 'new.player.and.said'|trans }}: <em>"{{ update.description }}"</em></p>
            {% endset %}
        {# Game started #}
        {% elseif update.type == 'game.started' %}
            {% set icon %}
                <span class="glyphicon glyphicon-flag"></span>
            {% endset %}
            {% set content %}
                <h4>{{ update.title|trans(update.parameters) }}</h4>
                <p>{{ update.description|trans(update.parameters) }}</p>
            {% endset %}
        {# Match updated #}
        {% elseif update.type == 'match.updated' %}
            {% set icon %}{% endset %}
            {% set content %}
            <h4>{{ 'p1.won.agianst.p2'|trans(update.parameters) }}</h4>
            <div class="scoreboard">
                <div class="player1">
                    <img src="{{ user(update.parameters['player_1_id']).profilePicture }}" />
                    <div class="score">{{ update.parameters['%player_1_score%'] }}</div>
                </div>
                <div class="player2">
                    <img src="{{ user(update.parameters['player_2_id']).profilePicture }}" />
                    <div class="score">{{ update.parameters['%player_2_score%'] }}</div>
                </div>
                <div class="clearfix"></div>
            </div>
            {% endset %}
        {% elseif update.type == 'round.played' %}
            {% set icon %}
                <span class="glyphicon glyphicon-ok"></span>
            {% endset %}
            {% set content %}
                <h4>{{ update.title|trans(update.parameters) }}</h4>
                <p>{{ update.description|trans(update.parameters) }}</p>
            {% endset %}
        {% elseif update.type == 'tournament.winner' %}
            {% set icon %}
                <span class="glyphicon glyphicon-star"></span>
            {% endset %}
            {% set content %}
                <h3>{{ 'tournament.ended.title'|trans }}</h3>
                <div class="tournament-ended">
                    <p>{{ 'tournament.ended.description'|trans(update.parameters) }}</p>
                    <img class="img-responsive" src="{{ user(update.parameters['%winner_id%']).profilePicture }}" />
                </div>
            {% endset %}
        {# Regular updates #}
        {% else %}
            {% set icon %}{% endset %}
            {% set content %}
                <h4>{{ update.title|trans(update.parameters) }}</h4>
                <p>{{ update.description|trans(update.parameters) }}</p>
            {% endset %}
        {% endif %}
        <div class="update {{ update.type|replace({'.':'-'}) }}">
            <div class="icon-container">{{ icon }}</div>
            <div class="content-container">{{ content }}</div>
        </div>
    {% endfor %}
</div><commit_msg>made gameupdates more dynamic by only relying on the player ID<commit_after>{% trans_default_domain 'game_updates' %}
<div class="game-updates">
    {% set lastDate = null %}
    {% for update in updates %}
        {% if update.parameters['%winner_id%'] is defined %}
            {% set user = user(update.parameters['%winner_id%']) %}
        {% endif %}
        {% set formattedDate = update.dateCreated|localizeddate('long', 'none') %}
        {% if lastDate != formattedDate %}
            <div class="date-header">{{ formattedDate }}:</div>
            {% set lastDate = formattedDate %}
        {% endif %}
        {# New Player message#}
        {% if update.type == 'new.player' %}
            {% set icon %}
                <img src="{{ user.profilePicture }}" />
            {% endset %}
            {% set content %}
                <h4>{{ update.title|trans({ player: user.username}) }}</h4>
                <p>.. {{ 'new.player.and.said'|trans }}: <em>"{{ update.description }}"</em></p>
            {% endset %}
        {# Game started #}
        {% elseif update.type == 'game.started' %}
            {% set icon %}
                <span class="glyphicon glyphicon-flag"></span>
            {% endset %}
            {% set content %}
                <h4>{{ update.title|trans(update.parameters) }}</h4>
                <p>{{ update.description|trans(update.parameters) }}</p>
            {% endset %}
        {# Match updated #}
        {% elseif update.type == 'match.updated' %}
            {% set icon %}{% endset %}
            {% set p1 = user(update.parameters['player_1_id']) %}
            {% set p2 = user(update.parameters['player_2_id']) %}
            {% set content %}
            <h4>
            {{ 'p1.won.agianst.p2'|trans({
                '%player_1_name%': p1.username,
                '%player_1_score%': update.parameters['%player_1_score%'],
                '%player_2_name%': p2.username,
                '%player_2_score%': update.parameters['%player_2_score%'],
            }) }}
            </h4>
            <div class="scoreboard">
                <div class="player1">
                    <img src="{{ p1.profilePicture }}" />
                    <div class="score">{{ update.parameters['%player_1_score%'] }}</div>
                </div>
                <div class="player2">
                    <img src="{{ p2.profilePicture }}" />
                    <div class="score">{{ update.parameters['%player_2_score%'] }}</div>
                </div>
                <div class="clearfix"></div>
            </div>
            {% endset %}
        {% elseif update.type == 'round.played' %}
            {% set icon %}
                <span class="glyphicon glyphicon-ok"></span>
            {% endset %}
            {% set content %}
                <h4>{{ update.title|trans(update.parameters) }}</h4>
                <p>{{ update.description|trans(update.parameters) }}</p>
            {% endset %}
        {% elseif update.type == 'tournament.winner' %}
            {% set icon %}
                <span class="glyphicon glyphicon-star"></span>
            {% endset %}
            {% set content %}
                <h3>{{ 'tournament.ended.title'|trans }}</h3>
                <div class="tournament-ended">
                    <p>{{ 'tournament.ended.description'|trans(update.parameters) }}</p>
                    <img class="img-responsive" src="{{ user.profilePicture }}" />
                </div>
            {% endset %}
        {# Regular updates #}
        {% else %}
            {% set icon %}{% endset %}
            {% set content %}
                <h4>{{ update.title|trans(update.parameters) }}</h4>
                <p>{{ update.description|trans(update.parameters) }}</p>
            {% endset %}
        {% endif %}
        <div class="update {{ update.type|replace({'.':'-'}) }}">
            <div class="icon-container">{{ icon }}</div>
            <div class="content-container">{{ content }}</div>
        </div>
    {% endfor %}
</div>
{'fraction_non_alphanumeric': 0.17914334071084495, 'fraction_numerical': 0.006769951829188907, 'mean_word_length': 1.5787176905001679, 'pattern_counts': {'":': 0, '<': 119, '<?xml version=': 0, '>': 119, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6100316', 'n_tokens_mistral': 2331, 'n_tokens_neox': 2050, 'n_words': 397}