Browse Source

Filter out resigned offer subscription.

opi 8 years ago
parent
commit
7cb9482c12
1 changed files with 3 additions and 1 deletions
  1. 3 1
      coin/offers/management/commands/offer_subscriptions_count.py

+ 3 - 1
coin/offers/management/commands/offer_subscriptions_count.py

@@ -2,7 +2,8 @@
 from __future__ import unicode_literals
 
 from django.core.management.base import BaseCommand, CommandError
-from django.db.models import Count
+from django.db.models import Q, Count
+import datetime
 
 from coin.offers.models import Offer, OfferSubscription
 
@@ -15,6 +16,7 @@ class Command(BaseCommand):
 
     def handle(self, *args, **options):
         offers = Offer.objects\
+                      .filter(Q(offersubscription__resign_date__gt=datetime.date.today) | Q(offersubscription__resign_date__isnull=True))\
                       .annotate(num_subscribtions=Count('offersubscription'))\
                       .order_by('name')
         for offer in offers: