feat: improve display performance of rescue orgs by limiting

This commit is contained in:
2025-06-22 09:06:24 +02:00
parent 4bb4d0386b
commit aabc549bcf
2 changed files with 26 additions and 9 deletions

View File

@@ -2,13 +2,28 @@
{% load i18n %}
{% block content %}
<h1 class="title is-1">{% translate "Aktualitätscheck" %}</h1>
<p>{% translate "Überprüfe ob im Tierheim neue Vermittlungen ein Zuhause suchen" %}</p>
<p class="subtitle is-2">{% translate "Überprüfe ob es in Tierheimen neue Tiere gibt die ein Zuhause suchen" %}</p>
<div class="grid is-col-min-15">
{% for rescue_org in rescue_orgs %}
<div class="cell">
{% include "fellchensammlung/partials/partial-check-rescue-org.html" %}
</div>
{% endfor %}
<div class="block">
<h2 class="title is-3">{% translate "Am längsten nicht geprüft" %}</h2>
<div class="grid is-col-min-15">
{% for rescue_org in rescue_orgs_to_check %}
<div class="cell">
{% include "fellchensammlung/partials/partial-check-rescue-org.html" %}
</div>
{% endfor %}
</div>
</div>
<hr>
<div class="block">
<h2 class="title is-3">{% translate "Zuletzt geprüft" %}</h2>
<div class="grid is-col-min-15">
{% for rescue_org in rescue_orgs_last_checked %}
<div class="cell">
{% include "fellchensammlung/partials/partial-check-rescue-org.html" %}
</div>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@@ -723,8 +723,10 @@ def rescue_organization_check(request, context=None):
species_url_instance.rescue_organization_id = rescue_org.id
species_url_instance.save()
last_checked_rescue_orgs = RescueOrganization.objects.filter(exclude_from_check=False).order_by("last_checked")
context["rescue_orgs"] = last_checked_rescue_orgs
rescue_orgs_to_check = RescueOrganization.objects.filter(exclude_from_check=False).order_by("last_checked")[:10]
rescue_orgs_last_checked = RescueOrganization.objects.filter().order_by("-last_checked")[:10]
context["rescue_orgs_to_check"] = rescue_orgs_to_check
context["rescue_orgs_last_checked"] = rescue_orgs_last_checked
return render(request, 'fellchensammlung/rescue-organization-check.html', context=context)