realm_stats: only count active (not deactivated) users.

(imported from commit e35838d5bb6260efb33290ab63fdbd10a3d9d879)
This commit is contained in:
Jessica McKellar 2013-05-01 11:01:08 -04:00
parent 5fb65712af
commit ce218dec48
1 changed files with 2 additions and 1 deletions

View File

@ -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)