feat: Add AN metrics by status

This commit is contained in:
moanos [he/him] 2024-06-06 23:22:05 +02:00
parent c38f1d2244
commit 2bd40d1278

View File

@ -8,7 +8,14 @@ def gather_metrics_data():
"""Adoption notices"""
num_adoption_notices = AdoptionNotice.objects.count()
num_adoption_notices_active = AdoptionNotice.objects.filter(adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).count()
num_adoption_notices_active = AdoptionNotice.objects.filter(
adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).count()
num_adoption_notices_closed = AdoptionNotice.objects.filter(
adoptionnoticestatus__major_status=AdoptionNoticeStatus.CLOSED).count()
num_adoption_notices_disabled = AdoptionNotice.objects.filter(
adoptionnoticestatus__major_status=AdoptionNoticeStatus.DISABLED).count()
num_adoption_notices_in_review = AdoptionNotice.objects.filter(
adoptionnoticestatus__major_status=AdoptionNoticeStatus.IN_REVIEW).count()
adoption_notices_without_location = AdoptionNotice.objects.filter(location__isnull=True).count()
data = {
@ -16,7 +23,12 @@ def gather_metrics_data():
'staff': num_staff,
'adoption_notices': num_adoption_notices,
'adoption_notices_active': num_adoption_notices_active,
'adoption_notices_by_status': {
'active': num_adoption_notices_active,
'closed': num_adoption_notices_closed,
'disabled': num_adoption_notices_disabled,
'in_review': num_adoption_notices_in_review,
},
'adoption_notices_without_location': adoption_notices_without_location
}
return data