8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-22 23:13:46 +00:00

fix: Deposits statistics headers

This commit is contained in:
Jean-Romain Garnier 2021-08-07 23:22:27 +02:00
parent 8138aa9af1
commit 5dd2625c4a

View file

@ -272,8 +272,8 @@ def index_stats(request):
"title": _("Deposits by payment method"), "title": _("Deposits by payment method"),
"headers": [ "headers": [
_("Payment method"), _("Payment method"),
_("Returned deposits"),
_("Unreturned deposits"), _("Unreturned deposits"),
_("Returned deposits"),
_("Total"), _("Total"),
_("Amount"), _("Amount"),
], ],
@ -303,8 +303,8 @@ def index_stats(request):
"title": _("Deposits by item type"), "title": _("Deposits by item type"),
"headers": [ "headers": [
_("Deposit item"), _("Deposit item"),
_("Returned deposits"),
_("Unreturned deposits"), _("Unreturned deposits"),
_("Returned deposits"),
_("Total"), _("Total"),
_("Amount"), _("Amount"),
], ],
@ -318,7 +318,7 @@ def index_stats(request):
.aggregate(Sum("deposit_amount")) .aggregate(Sum("deposit_amount"))
.get("deposit_amount__sum", None) .get("deposit_amount__sum", None)
) )
reimbursed_amount = ( returned_amount = (
Deposit.objects.filter(returned=True) Deposit.objects.filter(returned=True)
.aggregate(Sum("deposit_amount")) .aggregate(Sum("deposit_amount"))
.get("deposit_amount__sum", None) .get("deposit_amount__sum", None)
@ -333,7 +333,7 @@ def index_stats(request):
( (
_("Already returned"), _("Already returned"),
Deposit.objects.filter(returned=True).count(), Deposit.objects.filter(returned=True).count(),
"{}".format(reimbursed_amount or 0), "{}".format(returned_amount or 0),
), ),
] ]