fix: catch error if there are no rescue orgs

This commit is contained in:
2025-06-23 22:34:44 +02:00
parent f5dbccb9c4
commit 78866c86cd

View File

@@ -740,7 +740,10 @@ def rescue_organization_check(request, context=None):
num_rescue_orgs_to_check = RescueOrganization.objects.filter(last_checked__lt=timeframe).count()
num_rescue_orgs_checked = RescueOrganization.objects.filter(last_checked__gte=timeframe).count()
percentage_checked = 100*num_rescue_orgs_checked/(num_rescue_orgs_to_check+num_rescue_orgs_checked)
try:
percentage_checked = 100*num_rescue_orgs_checked/(num_rescue_orgs_to_check+num_rescue_orgs_checked)
except ZeroDivisionError:
percentage_checked = 100
context["rescue_orgs_to_check"] = rescue_orgs_to_check
context["rescue_orgs_last_checked"] = rescue_orgs_last_checked