From 0c3805d86d74621a9d7b30697b9f6f298e459417 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 21 Apr 2020 00:15:19 +0000 Subject: [PATCH] Correct member count to remove "Past Prospect" members --- apiserver/apiserver/api/utils_stats.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apiserver/apiserver/api/utils_stats.py b/apiserver/apiserver/api/utils_stats.py index 85c85c2..89b9aab 100644 --- a/apiserver/apiserver/api/utils_stats.py +++ b/apiserver/apiserver/api/utils_stats.py @@ -46,14 +46,18 @@ def calc_next_events(): def calc_member_counts(): members = models.Member.objects + not_paused = members.filter(paused_date__isnull=True) - num_not_paused = members.filter(paused_date__isnull=True).count() - num_paused = members.filter(paused_date__isnull=False).count() - num_current = members.filter(status='Current').count() - num_prepaid = members.filter(status='Prepaid').count() + num_current = not_paused.filter(status='Current').count() + num_prepaid = not_paused.filter(status='Prepaid').count() + num_due = not_paused.filter(status='Due').count() + num_overdue = not_paused.filter(status='Overdue').count() - cache.set('member_count', num_not_paused) - cache.set('paused_count', num_paused) + num_active = num_current + num_prepaid + num_due + num_overdue + num_former = members.count() - num_active + + cache.set('member_count', num_active) + cache.set('paused_count', num_former) cache.set('green_count', num_current + num_prepaid) def check_minecraft_server():