handle none

This commit is contained in:
Alysia Broddrick 2024-03-07 20:03:10 -08:00
parent fda2c11fb1
commit 33b47d27d1
No known key found for this signature in database
GPG key ID: 03917052CD0F06B7

View file

@ -376,6 +376,9 @@ def analytics(request):
approval_time=F("approved_domain__created_at") - F("submission_date")
).aggregate(Avg("approval_time"))["approval_time__avg"]
# Format the timedelta to display only days
avg_approval_time="No approvals to use"
if avg_approval_time is not None:
avg_approval_time = f"{avg_approval_time.days} days"
# The start and end dates are passed as url params