Add stats for number of vetted members

This commit is contained in:
Tanner Collin 2020-11-19 00:52:33 +00:00
parent 9156bcdba3
commit 276e9b9b5b
3 changed files with 6 additions and 2 deletions

View File

@ -9,7 +9,7 @@ class Command(BaseCommand):
def generate_stats(self):
utils_stats.calc_next_events()
member_count, green_count, six_month_plus_count = utils_stats.calc_member_counts()
member_count, green_count, six_month_plus_count, vetted_count = utils_stats.calc_member_counts()
signup_count = utils_stats.calc_signup_counts()
# do this hourly in case an admin causes a change
@ -19,6 +19,7 @@ class Command(BaseCommand):
member_count=member_count,
green_count=green_count,
six_month_plus_count=six_month_plus_count,
vetted_count=vetted_count,
),
)

View File

@ -143,6 +143,7 @@ class StatsMemberCount(models.Model):
member_count = models.IntegerField()
green_count = models.IntegerField()
six_month_plus_count = models.IntegerField()
vetted_count = models.IntegerField()
class StatsSignupCount(models.Model):
month = models.DateField()

View File

@ -67,11 +67,13 @@ def calc_member_counts():
six_months_ago = today_alberta_tz() - timedelta(days=183)
six_month_plus_count = not_paused.filter(application_date__lte=six_months_ago).count()
vetted_count = not_paused.filter(vetted_date__isnull=False).count()
cache.set('member_count', member_count)
cache.set('paused_count', paused_count)
cache.set('green_count', green_count)
return member_count, green_count, six_month_plus_count
return member_count, green_count, six_month_plus_count, vetted_count
def calc_signup_counts():
month_beginning = today_alberta_tz().replace(day=1)