From 51df946bac54b306fba9f34beae857cc429a065c Mon Sep 17 00:00:00 2001 From: moanos Date: Sun, 29 Sep 2024 17:03:46 +0200 Subject: [PATCH] feat: Show which objects are not-geocoded --- .../instance-health-check.html | 33 +++++++++++++++++-- src/fellchensammlung/views.py | 9 +++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html b/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html index e3e4e4c..a9639f4 100644 --- a/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html +++ b/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html @@ -22,10 +22,39 @@ {% else %}

{% translate "Texte scheinen vollständig" %}

{% endif %} +

{% translate "Nicht-lokalisierte Vermittlungen" %}

-

{{ number_not_geocoded_adoption_notices }}/{{ number_of_adoption_notices }}

+ {% if number_not_geocoded_adoption_notices > 0 %} +
+ {{ number_not_geocoded_adoption_notices }}/{{ number_of_adoption_notices }} + +
+ {% else %} +

{{ number_not_geocoded_adoption_notices }}/{{ number_of_adoption_notices }}

+ {% endif %} +

{% translate "Nicht-lokalisierte Tierschutzorganisationen" %}

-

{{ number_not_geocoded_rescue_orgs }}/{{ number_of_rescue_orgs }}

+ {% if number_not_geocoded_rescue_orgs > 0 %} +
+ {{ number_not_geocoded_rescue_orgs }}/{{ number_of_rescue_orgs }} + +
+ {% else %} +

{{ number_not_geocoded_rescue_orgs }}/{{ number_of_rescue_orgs }}

+ {% endif %} +
{% csrf_token %} diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index 0cac67d..678c339 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -429,10 +429,13 @@ def instance_health_check(request): clean_locations(quiet=False) number_of_adoption_notices = AdoptionNotice.objects.all().count() - number_not_geocoded_adoption_notices = AdoptionNotice.objects.filter(location__isnull=True).count() + none_geocoded_adoption_notices = AdoptionNotice.objects.filter(location__isnull=True) + number_not_geocoded_adoption_notices = len(none_geocoded_adoption_notices) + number_of_rescue_orgs = RescueOrganization.objects.all().count() - number_not_geocoded_rescue_orgs = RescueOrganization.objects.filter(location__isnull=True).count() + none_geocoded_rescue_orgs = RescueOrganization.objects.filter(location__isnull=True) + number_not_geocoded_rescue_orgs = len(none_geocoded_rescue_orgs) # CHECK FOR MISSING TEXTS languages = Language.objects.all() @@ -449,8 +452,10 @@ def instance_health_check(request): context = { "number_of_adoption_notices": number_of_adoption_notices, "number_not_geocoded_adoption_notices": number_not_geocoded_adoption_notices, + "none_geocoded_adoption_notices": none_geocoded_adoption_notices, "number_of_rescue_orgs": number_of_rescue_orgs, "number_not_geocoded_rescue_orgs": number_not_geocoded_rescue_orgs, + "none_geocoded_rescue_orgs": none_geocoded_rescue_orgs, "missing_texts": missing_texts }