mirror of https://github.com/zulip/zulip.git
Simplify analytics code to not filter certain low-interest users/realms.
(imported from commit 2dcf2e50b65c8b96d893cbe7dcdbbe652e6a90ff)
This commit is contained in:
parent
23a81af8ad
commit
e29c473077
|
@ -172,9 +172,7 @@ def realm_summary_table(realm_minutes):
|
|||
GROUP BY realm_id
|
||||
) at_risk_counts
|
||||
ON at_risk_counts.realm_id = realm.id
|
||||
WHERE
|
||||
realm.domain not in ('customer4.invalid', 'wdaher.com')
|
||||
AND EXISTS (
|
||||
WHERE EXISTS (
|
||||
SELECT *
|
||||
FROM zerver_useractivity ua
|
||||
JOIN zerver_userprofile up
|
||||
|
@ -226,11 +224,6 @@ def realm_summary_table(realm_minutes):
|
|||
|
||||
# Count active sites
|
||||
def meets_goal(row):
|
||||
# The wdaher.com realm doesn't count toward company goals for
|
||||
# obvious reasons, and customer4.invalid is essentially a dup
|
||||
# for users.customer4.invalid.
|
||||
if row['domain'] in ['customer4.invalid', 'wdaher.com']:
|
||||
return False
|
||||
return row['active_user_count'] >= 5
|
||||
|
||||
num_active_sites = len(filter(meets_goal, rows))
|
||||
|
|
|
@ -25,12 +25,8 @@ users_who_sent_query = Message.objects.select_related("sender") \
|
|||
|
||||
def active_users():
|
||||
# Return a list of active users we want to count towards various
|
||||
# statistics. This eliminates bots, @zulip.com, @customer29.invalid and customer3.invalid
|
||||
exclude_realms = ["zulip.com", "customer29.invalid", "customer3.invalid",
|
||||
"ios_appreview.zulip.com", "wdaher.com", "customer30.invalid"]
|
||||
return UserProfile.objects.filter(is_bot=False, is_active=True) \
|
||||
.exclude(realm__domain__in=exclude_realms) \
|
||||
.select_related()
|
||||
# statistics.
|
||||
return UserProfile.objects.filter(is_bot=False, is_active=True).select_related()
|
||||
|
||||
def users_who_sent_between(begin, end):
|
||||
sender_objs = users_who_sent_query.filter(pub_date__gt=begin, pub_date__lt=end) \
|
||||
|
@ -65,10 +61,6 @@ def seconds_active_during_day(day):
|
|||
end_day = day.replace(hour=23, minute=59, second=59, microsecond=0, tzinfo=utc)
|
||||
active_users = active_users_to_measure()
|
||||
|
||||
# Exclude Friday CUSTOMER4 activity numbers
|
||||
if day.weekday() == 4:
|
||||
active_users = [u for u in active_users if u.realm.domain != 'users.customer4.invalid']
|
||||
|
||||
return [seconds_usage_between(user, begin_day, end_day).total_seconds() for user in active_users]
|
||||
|
||||
def users_active_nosend_during_day(day):
|
||||
|
|
Loading…
Reference in New Issue