mirror of
https://github.com/ae-utbm/sith.git
synced 2026-10-24 11:19:33 +00:00
Merge pull request #1525 from ae-utbm/show-all-counters-in-stats
Show all counters in user stats view
This commit is contained in:
2 files changed
+4
-5
No files matched your search
@@ -31,10 +31,10 @@
|
||||
{% for sum in purchase_sums %}
|
||||
<div>
|
||||
<span>{{ sum["counter__name"] }}</span>
|
||||
<span>{{ sum["total"] }} €</span>
|
||||
<span>{{ "%.2f"|format(sum["total"]) }} €</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div><b>Total : </b><b>{{ total_purchases }} €</b></div>
|
||||
<div><b>Total : </b><b>{{ "%.2f"|format(total_purchases) }} €</b></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-3
@@ -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")
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user