From aabc549bcf7bb096c467585f44bf93bb30369376 Mon Sep 17 00:00:00 2001 From: moanos Date: Sun, 22 Jun 2025 09:06:24 +0200 Subject: [PATCH] feat: improve display performance of rescue orgs by limiting --- .../rescue-organization-check.html | 29 ++++++++++++++----- src/fellchensammlung/views.py | 6 ++-- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/fellchensammlung/templates/fellchensammlung/rescue-organization-check.html b/src/fellchensammlung/templates/fellchensammlung/rescue-organization-check.html index 95c2a3e..75523a1 100644 --- a/src/fellchensammlung/templates/fellchensammlung/rescue-organization-check.html +++ b/src/fellchensammlung/templates/fellchensammlung/rescue-organization-check.html @@ -2,13 +2,28 @@ {% load i18n %} {% block content %}

{% translate "Aktualitätscheck" %}

-

{% translate "Überprüfe ob im Tierheim neue Vermittlungen ein Zuhause suchen" %}

+

{% translate "Überprüfe ob es in Tierheimen neue Tiere gibt die ein Zuhause suchen" %}

-
- {% for rescue_org in rescue_orgs %} -
- {% include "fellchensammlung/partials/partial-check-rescue-org.html" %} -
- {% endfor %} +
+

{% translate "Am längsten nicht geprüft" %}

+
+ {% for rescue_org in rescue_orgs_to_check %} +
+ {% include "fellchensammlung/partials/partial-check-rescue-org.html" %} +
+ {% endfor %} +
+
+
+ +
+

{% translate "Zuletzt geprüft" %}

+
+ {% for rescue_org in rescue_orgs_last_checked %} +
+ {% include "fellchensammlung/partials/partial-check-rescue-org.html" %} +
+ {% endfor %} +
{% endblock %} diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index 24b114c..01952dd 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -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)