feat: Add overview of missing texts
This commit is contained in:
parent
cabb7f7181
commit
b8fe6b6655
@ -1,15 +1,37 @@
|
|||||||
{% extends "fellchensammlung/base_generic.html" %}
|
{% extends "fellchensammlung/base_generic.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h1>{% translate "Instanz-Check" %}</h1>
|
<h1>{% translate "Instanz-Check" %}</h1>
|
||||||
<p>{% translate "Nicht-lokalisierte Vermittlungen" %}: {{ number_not_geocoded_adoption_notices }}/{{ number_of_adoption_notices }}</p>
|
{% if missing_texts|length > 0 %}
|
||||||
<p>{% translate "Nicht-lokalisierte Tierschutzorganisationen" %}: {{ number_not_geocoded_rescue_orgs }}/{{ number_of_rescue_orgs }}</p>
|
<h2>{% trans "Fehlende Texte" %}</h2>
|
||||||
|
<p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>{% translate "Text Code" %}</th>
|
||||||
|
<th>{% translate "Sprache" %}</th>
|
||||||
|
</tr>
|
||||||
|
{% for missing_text in missing_texts %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ missing_text.0 }}</td>
|
||||||
|
<td>{{ missing_text.1 }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</p>
|
||||||
|
{% else %}
|
||||||
|
<p>{% translate "Texte scheinen vollständig" %}</p>
|
||||||
|
{% endif %}
|
||||||
|
<h2>{% translate "Nicht-lokalisierte Vermittlungen" %}</h2>
|
||||||
|
<p>{{ number_not_geocoded_adoption_notices }}/{{ number_of_adoption_notices }}</p>
|
||||||
|
<h2>{% translate "Nicht-lokalisierte Tierschutzorganisationen" %}</h2>
|
||||||
|
<p>{{ number_not_geocoded_rescue_orgs }}/{{ number_of_rescue_orgs }}</p>
|
||||||
|
<form class="notification-card-mark-read" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="action" value="clean_locations">
|
||||||
|
<button class="btn" type="submit" id="submit">
|
||||||
|
<i class="fa-solid fa-broom"></i> {% translate "Erneut lokalisieren" %}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<form class="notification-card-mark-read" method="POST">
|
{% endblock content %}
|
||||||
{% csrf_token %}
|
|
||||||
<input type="hidden" name="action" value="clean_locations">
|
|
||||||
<button class="btn2" type="submit" id="submit"><i class="fa-solid fa-broom"></i> {% translate "Erneut lokalisieren" %}</button>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
||||||
|
@ -428,12 +428,28 @@ def instance_health_check(request):
|
|||||||
|
|
||||||
number_of_rescue_orgs = RescueOrganization.objects.all().count()
|
number_of_rescue_orgs = RescueOrganization.objects.all().count()
|
||||||
number_not_geocoded_rescue_orgs = RescueOrganization.objects.filter(location__isnull=True).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 = {
|
context = {
|
||||||
"number_of_adoption_notices": number_of_adoption_notices,
|
"number_of_adoption_notices": number_of_adoption_notices,
|
||||||
"number_not_geocoded_adoption_notices": number_not_geocoded_adoption_notices,
|
"number_not_geocoded_adoption_notices": number_not_geocoded_adoption_notices,
|
||||||
"number_of_rescue_orgs": number_of_rescue_orgs,
|
"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)
|
return render(request, 'fellchensammlung/instance-health-check.html', context=context)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user