feat: Show which objects are not-geocoded

This commit is contained in:
moanos [he/him] 2024-09-29 17:03:46 +02:00
parent 36c2004b0f
commit 51df946bac
2 changed files with 38 additions and 4 deletions

View File

@ -22,10 +22,39 @@
{% else %}
<p>{% translate "Texte scheinen vollständig" %}</p>
{% endif %}
<h2>{% translate "Nicht-lokalisierte Vermittlungen" %}</h2>
{% if number_not_geocoded_adoption_notices > 0 %}
<details>
<summary>{{ number_not_geocoded_adoption_notices }}/{{ number_of_adoption_notices }}</summary>
<ul>
{% for adoption_notice in none_geocoded_adoption_notices %}
<li>
<a href="{{ adoption_notice.get_absolute_url }}">{{ adoption_notice.name }}</a>
</li>
{% endfor %}
</ul>
</details>
{% else %}
<p>{{ number_not_geocoded_adoption_notices }}/{{ number_of_adoption_notices }}</p>
{% endif %}
<h2>{% translate "Nicht-lokalisierte Tierschutzorganisationen" %}</h2>
{% if number_not_geocoded_rescue_orgs > 0 %}
<details>
<summary>{{ number_not_geocoded_rescue_orgs }}/{{ number_of_rescue_orgs }}</summary>
<ul>
{% for rescue_org in none_geocoded_rescue_orgs %}
<li>
<a href="{{ rescue_org.get_absolute_url }}">{{ rescue_org.name }}</a>
</li>
{% endfor %}
</ul>
</details>
{% else %}
<p>{{ number_not_geocoded_rescue_orgs }}/{{ number_of_rescue_orgs }}</p>
{% endif %}
<form class="notification-card-mark-read" method="post">
{% csrf_token %}
<input type="hidden" name="action" value="clean_locations">

View File

@ -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
}