stats.jinja 1.71 KB
Newer Older
Sli's avatar
Sli committed
1 2 3 4 5 6 7 8
{% extends "core/base.jinja" %}

{% block title %}
    {% trans %}Subscription stats{% endtrans %}
{% endblock %}

{% block content %}

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<p>
    {{ form.start_date.label }}<br>
    {{ form.start_date }}<br><br>
    {{ form.end_date.label }}<br>
    {{ form.end_date }}<br>
    <p><input type="submit" value="{% trans %}Go{% endtrans %}" /></p>
</p>

<p>
    {% trans %}Total subscriptions{% endtrans %} : {{ subscriptions_total.count() }}<br><br>
    {% trans %}Subscriptions by type{% endtrans %}<br><br>
    {% for location in locations %}
        {{ location[1] }} : {{ subscriptions_total.filter(location=location[0]).count() }}<br>
    {% endfor %}
<p>
Sli's avatar
Sli committed
24 25 26 27 28

<br>

<table>
    <tr>
29
        <th>{% trans %}Subscription type{% endtrans %}</th>
Sli's avatar
Sli committed
30 31 32
        {% for location in locations %}
            <th>{{ location[1] }}</th>
        {% endfor %}
33
        <th>{% trans %}Total{% endtrans %}</th>
Sli's avatar
Sli committed
34 35 36
        {% for type in subscriptions_types %}
        <tr>
            <td>{{ subscriptions_types[type]['name'] }}</td>
37
            {% set subscriptions_total_type = subscriptions_total.filter(subscription_type=type) %}
Sli's avatar
Sli committed
38 39
            {% for location in locations %}
                <td>
40 41
                {% set subscriptions_total_type_location = subscriptions_total_type.filter(location=location[0]) %}
                {% trans %}Total{% endtrans %} : {{ subscriptions_total_type_location.count()}}<br>
Sli's avatar
Sli committed
42
                {% for p_type in payment_types %}
43
                {{ p_type[1] }} : {{ subscriptions_total_type_location.filter(payment_method=p_type[0]).count()}}<br>
Sli's avatar
Sli committed
44 45 46
                {% endfor %}
                </td>
            {% endfor %}
47
            <td>{{subscriptions_total_type.count()}}
Sli's avatar
Sli committed
48 49 50 51 52
        </tr>
        {% endfor %}
</table>

{% endblock %}