Skip to content

Commit

Permalink
Add sessions key to hits_per_day dict (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
haaavk authored Jul 20, 2021
1 parent 0153b1f commit 2d5fbae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shynet/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,10 @@ def _get_chart_data(self, sessions, hits, start_time, end_time, tz_now):
.order_by("date")
)
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):
day = (start_time + timezone.timedelta(days=day_offset)).date()
Expand Down

0 comments on commit 2d5fbae

Please sign in to comment.