From ce218dec480839a77ca1ddf176a1ca8264bd0757 Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Wed, 1 May 2013 11:01:08 -0400 Subject: [PATCH] realm_stats: only count active (not deactivated) users. (imported from commit e35838d5bb6260efb33290ab63fdbd10a3d9d879) --- zephyr/management/commands/realm_stats.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zephyr/management/commands/realm_stats.py b/zephyr/management/commands/realm_stats.py index 9d8d5e9bdc..8436fa308f 100644 --- a/zephyr/management/commands/realm_stats.py +++ b/zephyr/management/commands/realm_stats.py @@ -21,6 +21,7 @@ class Command(BaseCommand): activity_cutoff = datetime.datetime.now(tz=pytz.utc) - datetime.timedelta(days=7) return [activity.user_profile for activity in \ UserActivity.objects.filter(user_profile__realm=realm, + user_profile__is_active=True, last_visit__gt=activity_cutoff, query="/json/update_pointer", client__name="website")] @@ -75,7 +76,7 @@ class Command(BaseCommand): for realm in realms: print realm.domain - user_profiles = UserProfile.objects.filter(realm=realm) + user_profiles = UserProfile.objects.filter(realm=realm, is_active=True) active_users = self.active_users(realm) num_active = len(active_users)