Commit f1e54439 authored by Skia's avatar Skia
Browse files

Small stats fix

parent 324bd693
Pipeline #234 failed with stage
in 21 seconds
...@@ -227,10 +227,10 @@ class UserStatsView(UserTabsMixin, CanViewMixin, DetailView): ...@@ -227,10 +227,10 @@ class UserStatsView(UserTabsMixin, CanViewMixin, DetailView):
mde = Counter.objects.filter(name="MDE").first() mde = Counter.objects.filter(name="MDE").first()
gommette = Counter.objects.filter(name="La Gommette").first() gommette = Counter.objects.filter(name="La Gommette").first()
semester_start=Subscription.compute_start(d=date.today(), duration=3) semester_start=Subscription.compute_start(d=date.today(), duration=3)
kwargs['total_perm_time'] = sum([p.end-p.start for p in self.object.permanencies.all()], timedelta()) kwargs['total_perm_time'] = sum([p.end-p.start for p in self.object.permanencies.exclude(end=None)], timedelta())
kwargs['total_foyer_time'] = sum([p.end-p.start for p in self.object.permanencies.filter(counter=foyer)], timedelta()) kwargs['total_foyer_time'] = sum([p.end-p.start for p in self.object.permanencies.filter(counter=foyer).exclude(end=None)], timedelta())
kwargs['total_mde_time'] = sum([p.end-p.start for p in self.object.permanencies.filter(counter=mde)], timedelta()) kwargs['total_mde_time'] = sum([p.end-p.start for p in self.object.permanencies.filter(counter=mde).exclude(end=None)], timedelta())
kwargs['total_gommette_time'] = sum([p.end-p.start for p in self.object.permanencies.filter(counter=gommette)], timedelta()) kwargs['total_gommette_time'] = sum([p.end-p.start for p in self.object.permanencies.filter(counter=gommette).exclude(end=None)], timedelta())
kwargs['total_foyer_buyings'] = sum([b.unit_price*b.quantity for b in kwargs['total_foyer_buyings'] = sum([b.unit_price*b.quantity for b in
self.object.customer.buyings.filter(counter=foyer, date__gte=semester_start)]) self.object.customer.buyings.filter(counter=foyer, date__gte=semester_start)])
kwargs['total_mde_buyings'] = sum([b.unit_price*b.quantity for b in self.object.customer.buyings.filter(counter=mde, kwargs['total_mde_buyings'] = sum([b.unit_price*b.quantity for b in self.object.customer.buyings.filter(counter=mde,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment