From 78376eaca484954353d5425c055ca3c4503ff900 Mon Sep 17 00:00:00 2001 From: imperosol Date: Fri, 23 Oct 2026 16:03:40 +0200 Subject: [PATCH] don't restict user counter stats to bar counters --- core/templates/core/user_stats.jinja | 4 ++-- core/views/user.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/templates/core/user_stats.jinja b/core/templates/core/user_stats.jinja index 621c4956..28c59cad 100644 --- a/core/templates/core/user_stats.jinja +++ b/core/templates/core/user_stats.jinja @@ -31,10 +31,10 @@ {% for sum in purchase_sums %}
{{ sum["counter__name"] }} - {{ sum["total"] }} € + {{ "%.2f"|format(sum["total"]) }} €
{% endfor %} -
Total : {{ total_purchases }} €
+
Total : {{ "%.2f"|format(total_purchases) }} €
diff --git a/core/views/user.py b/core/views/user.py index 4fad761f..cfcaeff0 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -413,7 +413,7 @@ class UserStatsView(UserTabsMixin, UserPassesTestMixin, DetailView): kwargs = super().get_context_data(**kwargs) kwargs["perm_time"] = list( - self.object.permanencies.filter(end__isnull=False, counter__type="BAR") + self.object.permanencies.filter(end__isnull=False) .values("counter", "counter__name") .annotate(total=Sum(F("end") - F("start"), default=timedelta(seconds=0))) .order_by("-total") @@ -422,8 +422,7 @@ class UserStatsView(UserTabsMixin, UserPassesTestMixin, DetailView): [perm["total"] for perm in kwargs["perm_time"]], start=timedelta(seconds=0) ) kwargs["purchase_sums"] = list( - self.object.customer.buyings.filter(counter__type="BAR") - .values("counter", "counter__name") + self.object.customer.buyings.values("counter", "counter__name") .annotate(total=Sum(F("unit_price") * F("quantity"))) .order_by("-total") )