{% block main %}
-<table style="width: 100%;">
+<table style="" border="1">
<thead>
<tr>
- <th></th>
- <th>PayU</th>
- <th>PayU cykliczne</th>
- <th>PayPal</th>
+ <th style="width: 200px;"></th>
+ <th style="width: 200px;">PayU</th>
+ <th style="width: 200px;">PayU cykliczne</th>
+ <th style="width: 200px;">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>
+ <td style="position: relative">
+ <span style="z-index: 0; background: #92BD39; position: absolute;left:0; top:0; bottom: 0; width: {{ acq.payu.1 }}%;"></span>
+ <span style="z-index: 1; position: relative;">{{ acq.payu.0 }}</span>
+ </td>
+ <td style="position: relative">
+ <span style="z-index: 0; background: #92BD39; position: absolute;left:0; top:0; bottom: 0; width: {{ acq.payu_re.1 }}%;"></span>
+ <span style="z-index: 1; position: relative;">{{ acq.payu_re.0 }}</span>
+ </td>
+ <td style="position: relative">
+ <span style="z-index: 0; background: #92BD39; position: absolute;left:0; top:0; bottom: 0; width: {{ acq.paypal.1 }}%;"></span>
+ <span style="z-index: 1; position: relative;">{{ acq.paypal.0 }}</span>
+ </td>
</tr>
{% endfor %}
</tbody>
@permission_required('club.schedule_view')
def stats(request):
+ maxes = {}
acq = {}
today = date.today()
start = today - timedelta(365)
acq.setdefault(d, {})
acq[d].setdefault(m, 0)
acq[d][m] += schedule.amount
-
+
+ for a in acq.values():
+ for m, v in a.items():
+ maxes.setdefault(m, 0)
+ if v > maxes[m]:
+ maxes[m] = v
+
days = []
d = today
while d >= start:
- days.append((d.isoformat(), acq.get(d, {})))
+ a = acq.get(d, {})
+ for k, v in a.items():
+ a[k] = (v, 100 * v/(maxes[k] or 1))
+ days.append((d.isoformat(), a))
d -= timedelta(1)
return render(request, 'club/stats.html',