From fc18a37fbf0166cb50970d0327c36b696e9ba184 Mon Sep 17 00:00:00 2001 From: detraz Date: Sat, 22 Dec 2018 00:35:39 +0100 Subject: [PATCH] =?UTF-8?q?Add=20start=20date=20recherche=20adh=C3=A9rents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- re2o/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/re2o/utils.py b/re2o/utils.py index 9836a98c..7ec4bd36 100644 --- a/re2o/utils.py +++ b/re2o/utils.py @@ -59,7 +59,7 @@ def all_adherent(search_time=None): vente__in=Vente.objects.filter( facture__in=Facture.objects.all().exclude(valid=False) ) - ).filter(date_end__gt=search_time) + ).filter(Q(date_start__lt=search_time) & Q(date_end__gt=search_time)) ) ) ).distinct() @@ -71,7 +71,7 @@ def all_baned(search_time=None): search_time = timezone.now() return User.objects.filter( ban__in=Ban.objects.filter( - date_end__gt=search_time + Q(date_start__lt=search_time) & Q(date_end__gt=search_time) ) ).distinct() @@ -82,7 +82,7 @@ def all_whitelisted(search_time=None): search_time = timezone.now() return User.objects.filter( whitelist__in=Whitelist.objects.filter( - date_end__gt=search_time + Q(date_start__lt=search_time) & Q(date_end__gt=search_time) ) ).distinct() @@ -94,8 +94,8 @@ def all_has_access(search_time=None): search_time = timezone.now() return User.objects.filter( Q(state=User.STATE_ACTIVE) & - ~Q(ban__in=Ban.objects.filter(date_end__gt=search_time)) & - (Q(whitelist__in=Whitelist.objects.filter(date_end__gt=search_time)) | + ~Q(ban__in=Ban.objects.filter(Q(date_start__lt=search_time) & Q(date_end__gt=search_time))) & + (Q(whitelist__in=Whitelist.objects.filter(Q(date_start__lt=search_time) & Q(date_end__gt=search_time))) | Q(facture__in=Facture.objects.filter( vente__in=Vente.objects.filter( cotisation__in=Cotisation.objects.filter( @@ -104,7 +104,7 @@ def all_has_access(search_time=None): facture__in=Facture.objects.all() .exclude(valid=False) ) - ).filter(date_end__gt=search_time) + ).filter(Q(date_start__lt=search_time) & Q(date_end__gt=search_time)) ) ))) ).distinct()