fix: also exclude ongoing communication from check statistics

This commit is contained in:
2026-02-07 20:19:05 +01:00
parent c230020fc8
commit 96221a1232

View File

@@ -2,14 +2,19 @@ from datetime import timedelta
from django.utils import timezone
from fellchensammlung.models import User, AdoptionNotice, AdoptionNoticeStatusChoices, Animal, RescueOrganization
from fellchensammlung.models import User, AdoptionNotice, AdoptionNoticeStatusChoices, Animal, RescueOrganization, \
AllowUseOfMaterialsChices
def get_rescue_org_check_stats():
timeframe = timezone.now().date() - timedelta(days=14)
num_rescue_orgs_to_check = RescueOrganization.objects.filter(exclude_from_check=False).filter(
num_rescue_orgs_to_check = RescueOrganization.objects.filter(exclude_from_check=False,
ongoing_communication=False).exclude(
allows_using_materials=AllowUseOfMaterialsChices.USE_MATERIALS_DENIED).filter(
last_checked__lt=timeframe).count()
num_rescue_orgs_checked = RescueOrganization.objects.filter(exclude_from_check=False).filter(
num_rescue_orgs_checked = RescueOrganization.objects.filter(exclude_from_check=False,
ongoing_communication=False).exclude(
allows_using_materials=AllowUseOfMaterialsChices.USE_MATERIALS_DENIED).filter(
last_checked__gte=timeframe).count()
try: