Add default 0 hits to chart_data (#195)
This commit is contained in:
parent
6032b9f4ee
commit
f6188a8bd1
@ -256,7 +256,8 @@ class Service(models.Model):
|
||||
.order_by("hour")
|
||||
)
|
||||
chart_data = {
|
||||
k["hour"]: {"sessions": k["count"]} for k in sessions_per_hour
|
||||
k["hour"]: {"sessions": k["count"], "hits": 0}
|
||||
for k in sessions_per_hour
|
||||
}
|
||||
hits_per_hour = (
|
||||
hits.annotate(hour=TruncHour("start_time"))
|
||||
@ -284,7 +285,9 @@ class Service(models.Model):
|
||||
.annotate(count=models.Count("uuid"))
|
||||
.order_by("date")
|
||||
)
|
||||
chart_data = {k["date"]: {"sessions": k["count"]} for k in sessions_per_day}
|
||||
chart_data = {
|
||||
k["date"]: {"sessions": k["count"], "hits": 0} for k in sessions_per_day
|
||||
}
|
||||
hits_per_day = (
|
||||
hits.annotate(date=TruncDate("start_time"))
|
||||
.values("date")
|
||||
|
Loading…
Reference in New Issue
Block a user