Fix duration aggregation

This commit is contained in:
R. Miles McCain 2020-04-14 16:23:26 -04:00
parent 19fed23ed6
commit 00ef610a65
No known key found for this signature in database
GPG Key ID: 91CB47BDDF2671A5

View File

@ -125,7 +125,7 @@ class Service(models.Model):
try: try:
avg_session_duration = sessions.annotate( avg_session_duration = sessions.annotate(
duration=models.F("last_seen") - models.F("start_time") duration=models.F("last_seen") - models.F("start_time")
).aggregate(duration=models.Avg("duration"))["duration"] ).aggregate(time_delta=models.Avg("duration"))["time_delta"]
except NotSupportedError: except NotSupportedError:
avg_session_duration = sum( avg_session_duration = sum(
[ [