feat(kfet): Add a summary of the account balances
This commit is contained in:
parent
371580015c
commit
ce4d87571d
2 changed files with 32 additions and 1 deletions
|
@ -31,6 +31,28 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<aside>
|
||||||
|
<div class="heading">
|
||||||
|
{{ positive_count }}
|
||||||
|
<span class="sub">compte{{ positive_count|pluralize }} en positif</span>
|
||||||
|
</div>
|
||||||
|
<div class="heading">
|
||||||
|
{{ positives_sum|floatformat:2 }}€
|
||||||
|
<span class="sub">de positif total</span>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<aside>
|
||||||
|
<div class="heading">
|
||||||
|
{{ negative_count }}
|
||||||
|
<span class="sub">compte{{ negative_count|pluralize }} en négatif</span>
|
||||||
|
</div>
|
||||||
|
<div class="heading">
|
||||||
|
{{ negatives_sum|floatformat:2 }}€
|
||||||
|
<span class="sub">de négatif total</span>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
|
|
@ -184,7 +184,16 @@ class DemandeSoireeView(FormView):
|
||||||
@teamkfet_required
|
@teamkfet_required
|
||||||
def account(request):
|
def account(request):
|
||||||
accounts = Account.objects.select_related("cofprofile__user").order_by("trigramme")
|
accounts = Account.objects.select_related("cofprofile__user").order_by("trigramme")
|
||||||
return render(request, "kfet/account.html", {"accounts": accounts})
|
positive_accounts = Account.objects.filter(balance__gte=0)
|
||||||
|
negative_accounts = Account.objects.filter(balance__lt=0)
|
||||||
|
|
||||||
|
return render(request, "kfet/account.html", {
|
||||||
|
"accounts": accounts,
|
||||||
|
"positive_count": positive_accounts.count(),
|
||||||
|
"positives_sum": sum(acc.balance for acc in positive_accounts),
|
||||||
|
"negative_count": negative_accounts.count(),
|
||||||
|
"negatives_sum": sum(acc.balance for acc in negative_accounts),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Add table
Reference in a new issue