--- /dev/null
+{% extends "base.html" %}
+
+{% block main %}
+
+
+<table style="width: 100%;">
+ <thead>
+ <tr>
+ <th></th>
+ <th>PayU</th>
+ <th>PayU cykliczne</th>
+ <th>PayPal</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for day, acq in days %}
+ <tr>
+ <td>{{ day }}</td>
+ <td>{{ acq.payu }}</td>
+ <td>{{ acq.payu_re }}</td>
+ <td>{{ acq.paypal }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+
+{% endblock %}
path('weryfikacja/', views.member_verify, name='club_member_verify'),
path('potwierdzenie/', views.receipt, name='club_receipt'),
+ path('stats/', views.stats),
]
# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
#
+from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.decorators import login_required, permission_required
from django.db.models import Sum
}
)
+
+@permission_required('club.schedule_view')
+def stats(request):
+ acq = {}
+ today = date.today()
+ start = today - timedelta(365)
+ for schedule in models.Schedule.objects.filter(
+ payed_at__gte=start,
+ ):
+ d = schedule.payed_at.date()
+ m = schedule.method.replace('-', '_')
+ acq.setdefault(d, {})
+ acq[d].setdefault(m, 0)
+ acq[d][m] += schedule.amount
+
+ days = []
+ d = today
+ while d >= start:
+ days.append((d.isoformat(), acq.get(d, {})))
+ d -= timedelta(1)
+
+ return render(request, 'club/stats.html',
+ {'days': days})
+