Add sessions key to hits_per_day dict (#160)

This commit is contained in:
havk 2021-07-20 04:38:45 +02:00 committed by GitHub
parent 0153b1f847
commit 2d5fbae279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -292,7 +292,10 @@ class Service(models.Model):
.order_by("date") .order_by("date")
) )
for k in hits_per_day: for k in hits_per_day:
chart_data[k["date"]]["hits"] = k["count"] if k["date"] not in chart_data:
chart_data[k["date"]] = {"hits": k["count"], "sessions": 0}
else:
chart_data[k["date"]]["hits"] = k["count"]
for day_offset in range((end_time - start_time).days + 1): for day_offset in range((end_time - start_time).days + 1):
day = (start_time + timezone.timedelta(days=day_offset)).date() day = (start_time + timezone.timedelta(days=day_offset)).date()