Ignore soft deleted uses

This commit is contained in:
Tanner Collin 2022-02-11 04:47:41 +00:00
parent e8f8ca02da
commit 5cb3264045

View File

@ -765,10 +765,10 @@ class StatsViewSet(viewsets.ViewSet, List):
month_start = today_start.replace(day=1) month_start = today_start.replace(day=1)
today_total = device_uses.filter( today_total = device_uses.filter(
user=user, started_at__gte=today_start user=user, started_at__gte=today_start, deleted_at__isnull=True,
).aggregate(Sum('num_seconds'))['num_seconds__sum'] + running_cut_time ).aggregate(Sum('num_seconds'))['num_seconds__sum'] + running_cut_time
month_total = device_uses.filter( month_total = device_uses.filter(
user=user, started_at__gte=month_start user=user, started_at__gte=month_start, deleted_at__isnull=True,
).aggregate(Sum('num_seconds'))['num_seconds__sum'] + running_cut_time ).aggregate(Sum('num_seconds'))['num_seconds__sum'] + running_cut_time
try: try: