diff --git a/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html b/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html index 15a8612..e3e4e4c 100644 --- a/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html +++ b/src/fellchensammlung/templates/fellchensammlung/instance-health-check.html @@ -1,15 +1,37 @@ {% extends "fellchensammlung/base_generic.html" %} {% load i18n %} - {% block content %}

{% translate "Instanz-Check" %}

-

{% translate "Nicht-lokalisierte Vermittlungen" %}: {{ number_not_geocoded_adoption_notices }}/{{ number_of_adoption_notices }}

-

{% translate "Nicht-lokalisierte Tierschutzorganisationen" %}: {{ number_not_geocoded_rescue_orgs }}/{{ number_of_rescue_orgs }}

+ {% if missing_texts|length > 0 %} +

{% trans "Fehlende Texte" %}

+

+ + + + + + {% for missing_text in missing_texts %} + + + + + {% endfor %} +
{% translate "Text Code" %}{% translate "Sprache" %}
{{ missing_text.0 }}{{ missing_text.1 }}
+

+ {% else %} +

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

+ {% endif %} +

{% translate "Nicht-lokalisierte Vermittlungen" %}

+

{{ number_not_geocoded_adoption_notices }}/{{ number_of_adoption_notices }}

+

{% translate "Nicht-lokalisierte Tierschutzorganisationen" %}

+

{{ number_not_geocoded_rescue_orgs }}/{{ number_of_rescue_orgs }}

+
+ {% csrf_token %} + + +
-
- {% csrf_token %} - - -
-{% endblock %} +{% endblock content %} diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index a013623..7183144 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -428,12 +428,28 @@ def instance_health_check(request): number_of_rescue_orgs = RescueOrganization.objects.all().count() number_not_geocoded_rescue_orgs = RescueOrganization.objects.filter(location__isnull=True).count() + + # CHECK FOR MISSING TEXTS + languages = Language.objects.all() + texts = Text.objects.all() + text_codes = set([text.text_code for text in texts]) + missing_texts = [] + for language in languages: + for text_code in text_codes: + try: + Text.objects.get(text_code=text_code, language=language) + except Text.DoesNotExist: + missing_texts.append((text_code, language)) + context = { "number_of_adoption_notices": number_of_adoption_notices, "number_not_geocoded_adoption_notices": number_not_geocoded_adoption_notices, "number_of_rescue_orgs": number_of_rescue_orgs, - "number_not_geocoded_rescue_orgs": number_not_geocoded_rescue_orgs + "number_not_geocoded_rescue_orgs": number_not_geocoded_rescue_orgs, + "missing_texts": missing_texts } + + return render(request, 'fellchensammlung/instance-health-check.html', context=context)