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

{% block body -%}
    <div class="content-container">
        <h2 class="h2">Statistieken</h2>
        {% set totaltransactionup = 0 %}
        {% set totaltransactiondown = 0 %}
        {% for transaction in transactions %}
            {% if transaction.amount > 0 %}
                {% set totaltransactionup = totaltransactionup + transaction.amount %}
            {% elseif transaction.amount < 0 %}
                {% set totaltransactiondown = totaltransactiondown + transaction.amount %}
            {% endif %}
        {% endfor %}
        <div class="stat">
            <h2>Totaal opgewaardeerd</h2>
            {{ totaltransactionup }}
            <h2>Totaal afgeschreven</h2>
            {{ totaltransactiondown }}
        </div>
        <div class="stat">
            <h2>Uren totaal</h2>
            {{ totaaluren }}
            <h2>Gemiddelde sessieduur</h2>

            {% set sumratingsH = '0' %}
            {% set sumratingsi = '0' %}
            {% set sumratingss = '0' %}
            {% for checkin in checkins %}
                {% if checkin.sessionduration %}
                    {% set sumratingsH = sumratingsH + checkin.sessionduration|date('H') / loop.length %}
                    {% set sumratingsi = sumratingsi + checkin.sessionduration|date('i') / loop.length %}
                    {% set sumratingss = sumratingss + checkin.sessionduration|date('s') / loop.length %}
                {% endif %}
            {% endfor %}
            {% set sumratingshl = (sumratingsH - sumratingsH|round(0, 'floor')) *60 %}
            {% set sumratingsi = sumratingsi + sumratingshl %}
            {%  if sumratingsi > 60 %}
                {% set sumratingsi = sumratingsi / 60 %}
                {% set sumratingsH = sumratingsH + sumratingsi|round(0, 'floor') %}
                {% set sumratingsi = (sumratingsi - sumratingsi|round(0, 'floor')) *60 %}
            {% endif %}
            {% set sumratingsil = (sumratingsi - sumratingsi|round(0, 'floor')) *60 %}
            {% set sumratingss = sumratingss + sumratingsil %}
            {%  if sumratingss > 60 %}
                {% set sumratingss = sumratingss / 60 %}
                {% set sumratingsi = sumratingsi + sumratingss|round(0, 'floor') %}
                {% set sumratingss = (sumratingss - sumratingss|round(0, 'floor')) *60 %}
            {% endif %}
            <p>{{  sumratingsH|round(0, 'floor') }}:{{  "%02d"|format(sumratingsi|round(0, 'floor')) }}:{{  "%02d"|format(sumratingss|round)  }}</p>

            <div id="checkin_users" style="width:100%; height:400px;"></div>

                {{ dump(groupsessions) }}

        </div>
    </div>
    <script type="text/javascript">
        window.onload = function () {
            var chart = new CanvasJS.Chart("checkin_users", {

                title:{
                    text: "Checkins per dag"
                },
                data: [//array of dataSeries
                    { //dataSeries object

                        /*** Change type "column" to "bar", "area", "line" or "pie"***/
                        type: "column",
                        dataPoints: [
                            { label: "banana", y: 18 },
                            { label: "orange", y: 29 },
                            { label: "apple", y: 40 },
                            { label: "mango", y: 34 },
                            { label: "grape", y: 24 }
                        ]
                    }
                ]
            });

            chart.render();
        }
    </script>
{% endblock %}<commit_msg>added graph with checkins per day<commit_after>{% extends '::base.html.twig' %}

{% block body -%}
    <div class="content-container">
        <h2 class="h2">Statistieken</h2>
        {% set totaltransactionup = 0 %}
        {% set totaltransactiondown = 0 %}
        {% for transaction in transactions %}
            {% if transaction.amount > 0 %}
                {% set totaltransactionup = totaltransactionup + transaction.amount %}
            {% elseif transaction.amount < 0 %}
                {% set totaltransactiondown = totaltransactiondown + transaction.amount %}
            {% endif %}
        {% endfor %}
        <div class="stat">
            <h2>Totaal opgewaardeerd</h2>
            {{ totaltransactionup }}
            <h2>Totaal afgeschreven</h2>
            {{ totaltransactiondown }}
        </div>
        <div class="stat">
            <h2>Uren totaal</h2>
            {{ totaaluren }}
            <h2>Gemiddelde sessieduur</h2>

            {% set sumratingsH = '0' %}
            {% set sumratingsi = '0' %}
            {% set sumratingss = '0' %}
            {% for checkin in checkins %}
                {% if checkin.sessionduration %}
                    {% set sumratingsH = sumratingsH + checkin.sessionduration|date('H') / loop.length %}
                    {% set sumratingsi = sumratingsi + checkin.sessionduration|date('i') / loop.length %}
                    {% set sumratingss = sumratingss + checkin.sessionduration|date('s') / loop.length %}
                {% endif %}
            {% endfor %}
            {% set sumratingshl = (sumratingsH - sumratingsH|round(0, 'floor')) *60 %}
            {% set sumratingsi = sumratingsi + sumratingshl %}
            {%  if sumratingsi > 60 %}
                {% set sumratingsi = sumratingsi / 60 %}
                {% set sumratingsH = sumratingsH + sumratingsi|round(0, 'floor') %}
                {% set sumratingsi = (sumratingsi - sumratingsi|round(0, 'floor')) *60 %}
            {% endif %}
            {% set sumratingsil = (sumratingsi - sumratingsi|round(0, 'floor')) *60 %}
            {% set sumratingss = sumratingss + sumratingsil %}
            {%  if sumratingss > 60 %}
                {% set sumratingss = sumratingss / 60 %}
                {% set sumratingsi = sumratingsi + sumratingss|round(0, 'floor') %}
                {% set sumratingss = (sumratingss - sumratingss|round(0, 'floor')) *60 %}
            {% endif %}
            <p>{{  sumratingsH|round(0, 'floor') }}:{{  "%02d"|format(sumratingsi|round(0, 'floor')) }}:{{  "%02d"|format(sumratingss|round)  }}</p>

            <div id="checkin_users" style="width:100%; height:400px;"></div>

        </div>
    </div>
    <script type="text/javascript">
        window.onload = function () {
            var chart = new CanvasJS.Chart("checkin_users", {

                title:{
                    text: "Checkins per dag"
                },
                data: [//array of dataSeries
                    { //dataSeries object

                        /*** Change type "column" to "bar", "area", "line" or "pie"***/
                        type: "column",
                        dataPoints: [
                            {% for key,sessions in groupsessions %}
                            { label: "{{ key }}", y: {{ sessions }} },
                            {% endfor %}
                        ]
                    }
                ]
            });

            chart.render();
        }
    </script>
{% endblock %}
{'fraction_non_alphanumeric': 0.1432398139010292, 'fraction_numerical': 0.016072183843225715, 'mean_word_length': 1.5164952110677545, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1790700', 'n_tokens_mistral': 2258, 'n_tokens_neox': 1990, 'n_words': 411}