<commit_before>{% extends 'ClanmanagerBundle::base.html.twig' %}

{% block title %}CoC ClanManager{% endblock %}

{% block body %}

    <h1>
        {{ player.id }}. {{ player.tag }} {{ player.name }}
    </h1>

    <p>
        clan history:
    <table>
        <tr>
            <th>Clan</th>
            <th>Join</th>
            <th>Leave</th>
        </tr>
        {% for membership in player.memberships %}
            <tr>
                <td>{{ membership.clan.name }}</td>
                <td>{{ membership.start|date('Y/m/d') }}</td>
                <td>{{ membership.stop ? membership.stop|date('Y/m/d') : "---" }}</td>
            </tr>
        {% endfor %}
    </table>
</p>

<p>
    wars played in:
<table>

    <tr>
        <th colspan="2">war</th>
        <th></th>
        <th>#</th>
        <th>defenses</th>
        <th colspan="3">attacks</th>
    </tr>

    {% set stars=[0,0,0,0] %}

    {% for warplayer in player.warplayers %}
        <tr>
            <td>{{ warplayer.warclan.war.start|date('Y/m/d') }}</td>
            <td>{{ warplayer.warclan.war }}</td>
            <td>TH{{ warplayer.th }}</td>
            <td>{{ warplayer.rank }}</td>

            <td>
                {% if warplayer.defends|length > 0 %}
                    {% for n in 0..warplayer.defends|length-1 %}
                        <img height="10px" src="{{ asset( ['images/',warplayer.defends[n].stars,'star.png']|join ) }}">
                        <!-- {{ warplayer.defends[n].stars }}&nbsp; -->
                    {% endfor %}
                {% endif %}
            </td>

            {% if warplayer.attacks[0] is defined %}
                
                {% if warplayer.attacks[0].stars==0 %}
                {% set stars={ 0:stars[0]+1, 1:stars[1], 2:stars[2], 3:stars[3] } %}
                {% elseif warplayer.attacks[0].stars==1 %}
                {% set stars={ 0:stars[0], 1:stars[1]+1, 2:stars[2], 3:stars[3] } %}
                {% elseif warplayer.attacks[0].stars==2 %}
                {% set stars={ 0:stars[0], 1:stars[1], 2:stars[2]+1, 3:stars[3] } %}
                {% elseif warplayer.attacks[0].stars==3 %}
                {% set stars={ 0:stars[0], 1:stars[1], 2:stars[2], 3:stars[3]+1 } %}
                {% endif %}
                
                <td>{{ warplayer.attacks[0].defender }}</td>
                <td>TH{{ warplayer.attacks[0].defender.th }}</td>
                <td><img height="10px" src="{{ asset( ['images/',warplayer.attacks[0].stars,'star.png']|join ) }}"></td>
                <td>{{ warplayer.attacks[0].percent }}%</td>
            {% endif %}
            {% if warplayer.attacks[1] is defined %}
                {% if warplayer.attacks[1].stars==0 %}
                {% set stars={ 0:stars[0]+1, 1:stars[1], 2:stars[2], 3:stars[3] } %}
                {% elseif warplayer.attacks[1].stars==1 %}
                {% set stars={ 0:stars[0], 1:stars[1]+1, 2:stars[2], 3:stars[3] } %}
                {% elseif warplayer.attacks[1].stars==2 %}
                {% set stars={ 0:stars[0], 1:stars[1], 2:stars[2]+1, 3:stars[3] } %}
                {% elseif warplayer.attacks[1].stars==3 %}
                {% set stars={ 0:stars[0], 1:stars[1], 2:stars[2], 3:stars[3]+1 } %}
                {% endif %}
            </tr>
            <tr>
                <td></td><td></td><td></td><td></td><td></td>
                <td>{{ warplayer.attacks[1].defender }}</td>
                <td>TH{{ warplayer.attacks[1].defender.th }}</td>
                <td><img height="10px" src="{{ asset( ['images/',warplayer.attacks[1].stars,'star.png']|join ) }}"></td>
                <td>{{ warplayer.attacks[1].percent }}%</td>
            {% endif %}
        </tr>
    {% endfor %}

</table>
</p>



    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {

        var data = google.visualization.arrayToDataTable([
          ['Task', 'Hours per Day'],
          ['0:FAIL',{{ stars[0] }}],
          ['1',{{ stars[1] }}],
          ['2',{{ stars[2] }}],
          ['3',{{ stars[3] }}]
        ]);

        var options = {
          title: 'nr of Stars',
          slices: { 0:{color:'red'},1:{color:'orange'},2:{color:'lightgreen'},3:{color:'green'} }
        };

        var chart = new google.visualization.PieChart(document.getElementById('piechart'));

        chart.draw(data, options);
      }
    </script>
    <div id="piechart" style="width: 900px; height: 500px;"></div>
{% endblock %}<commit_msg>-player_view, added ranking difference on attacks<commit_after>{% extends 'ClanmanagerBundle::base.html.twig' %}

{% block title %}CoC ClanManager{% endblock %}

{% block body %}

    <h1>
        {{ player.id }}. {{ player.tag }} {{ player.name }}
    </h1>

    <p>
        clan history:
    <table>
        <tr>
            <th>Clan</th>
            <th>Join</th>
            <th>Leave</th>
        </tr>
        {% for membership in player.memberships %}
            <tr>
                <td>{{ membership.clan.name }}</td>
                <td>{{ membership.start|date('Y/m/d') }}</td>
                <td>{{ membership.stop ? membership.stop|date('Y/m/d') : "---" }}</td>
            </tr>
        {% endfor %}
    </table>
</p>

<p>
    wars played in:
<table>

    <tr>
        <th colspan="2">war</th>
        <th></th>
        <th>#</th>
        <th>defenses</th>
        <th colspan="3">attacks</th>
    </tr>

    {% set stars=[0,0,0,0] %}

    {% for warplayer in player.warplayers %}
        <tr>
            <td>{{ warplayer.warclan.war.start|date('Y/m/d') }}</td>
            <td>{{ warplayer.warclan.war }}</td>
            <td>TH{{ warplayer.th }}</td>
            <td>{{ warplayer.rank }}</td>

            <td>
                {% if warplayer.defends|length > 0 %}
                    {% for n in 0..warplayer.defends|length-1 %}
                        <img height="10px" src="{{ asset( ['images/',warplayer.defends[n].stars,'star.png']|join ) }}">
                        <!-- {{ warplayer.defends[n].stars }}&nbsp; -->
                    {% endfor %}
                {% endif %}
            </td>

            {% if warplayer.attacks[0] is defined %}
                
                {% if warplayer.attacks[0].stars==0 %}
                {% set stars={ 0:stars[0]+1, 1:stars[1], 2:stars[2], 3:stars[3] } %}
                {% elseif warplayer.attacks[0].stars==1 %}
                {% set stars={ 0:stars[0], 1:stars[1]+1, 2:stars[2], 3:stars[3] } %}
                {% elseif warplayer.attacks[0].stars==2 %}
                {% set stars={ 0:stars[0], 1:stars[1], 2:stars[2]+1, 3:stars[3] } %}
                {% elseif warplayer.attacks[0].stars==3 %}
                {% set stars={ 0:stars[0], 1:stars[1], 2:stars[2], 3:stars[3]+1 } %}
                {% endif %}
                
                <td>{{ "%+d"|format(warplayer.rank - warplayer.attacks[0].defender.rank) }}</td>
                <td>{{ warplayer.attacks[0].defender }}</td>
                <td>TH{{ warplayer.attacks[0].defender.th }}</td>
                <td><img height="10px" src="{{ asset( ['images/',warplayer.attacks[0].stars,'star.png']|join ) }}"></td>
                <td>{{ warplayer.attacks[0].percent }}%</td>
            {% endif %}
            {% if warplayer.attacks[1] is defined %}
                {% if warplayer.attacks[1].stars==0 %}
                {% set stars={ 0:stars[0]+1, 1:stars[1], 2:stars[2], 3:stars[3] } %}
                {% elseif warplayer.attacks[1].stars==1 %}
                {% set stars={ 0:stars[0], 1:stars[1]+1, 2:stars[2], 3:stars[3] } %}
                {% elseif warplayer.attacks[1].stars==2 %}
                {% set stars={ 0:stars[0], 1:stars[1], 2:stars[2]+1, 3:stars[3] } %}
                {% elseif warplayer.attacks[1].stars==3 %}
                {% set stars={ 0:stars[0], 1:stars[1], 2:stars[2], 3:stars[3]+1 } %}
                {% endif %}
            </tr>
            <tr>
                <td></td><td></td><td></td><td></td><td></td>
                <td>{{ "%+d"|format(warplayer.rank - warplayer.attacks[1].defender.rank) }}</td>
                <td>{{ warplayer.attacks[1].defender }}</td>
                <td>TH{{ warplayer.attacks[1].defender.th }}</td>
                <td><img height="10px" src="{{ asset( ['images/',warplayer.attacks[1].stars,'star.png']|join ) }}"></td>
                <td>{{ warplayer.attacks[1].percent }}%</td>
            {% endif %}
        </tr>
    {% endfor %}

</table>
</p>



    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {

        var data = google.visualization.arrayToDataTable([
          ['Task', 'Hours per Day'],
          ['0:FAIL',{{ stars[0] }}],
          ['1',{{ stars[1] }}],
          ['2',{{ stars[2] }}],
          ['3',{{ stars[3] }}]
        ]);

        var options = {
          title: 'nr of Stars',
          slices: { 0:{color:'red'},1:{color:'orange'},2:{color:'lightgreen'},3:{color:'green'} }
        };

        var chart = new google.visualization.PieChart(document.getElementById('piechart'));

        chart.draw(data, options);
      }
    </script>
    <div id="piechart" style="width: 900px; height: 500px;"></div>
{% endblock %}
{'fraction_non_alphanumeric': 0.21660345554150864, 'fraction_numerical': 0.028445006321112517, 'mean_word_length': 1.7994691831318195, 'pattern_counts': {'":': 0, '<': 183, '<?xml version=': 0, '>': 185, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '4890606', 'n_tokens_mistral': 3538, 'n_tokens_neox': 3086, 'n_words': 523}