counts: Create 7day_actives::day counstat.

This commit is contained in:
Vishnu KS 2020-08-07 11:39:50 +00:00 committed by Tim Abbott
parent 6698fedd1e
commit 4dc83a139c
2 changed files with 21 additions and 3 deletions

View File

@ -665,6 +665,10 @@ def get_count_stats(realm: Optional[Realm]=None) -> Dict[str, CountStat]:
sql_data_collector( sql_data_collector(
UserCount, check_useractivityinterval_by_user_query(realm), None), UserCount, check_useractivityinterval_by_user_query(realm), None),
CountStat.DAY, interval=timedelta(days=1)-UserActivityInterval.MIN_INTERVAL_LENGTH), CountStat.DAY, interval=timedelta(days=1)-UserActivityInterval.MIN_INTERVAL_LENGTH),
CountStat('7day_actives::day',
sql_data_collector(
UserCount, check_useractivityinterval_by_user_query(realm), None),
CountStat.DAY, interval=timedelta(days=7)-UserActivityInterval.MIN_INTERVAL_LENGTH),
CountStat('15day_actives::day', CountStat('15day_actives::day',
sql_data_collector( sql_data_collector(
UserCount, check_useractivityinterval_by_user_query(realm), None), UserCount, check_useractivityinterval_by_user_query(realm), None),

View File

@ -116,9 +116,21 @@ class Command(BaseCommand):
FillState.objects.create(property=stat.property, end_time=last_end_time, FillState.objects.create(property=stat.property, end_time=last_end_time,
state=FillState.DONE) state=FillState.DONE)
stat = COUNT_STATS['7day_actives::day']
realm_data = {
None: self.generate_fixture_data(stat, .2, .07, 3, .3, 6, partial_sum=True),
}
insert_fixture_data(stat, realm_data, RealmCount)
installation_data = {
None: self.generate_fixture_data(stat, 2, .7, 4, .3, 6, partial_sum=True),
}
insert_fixture_data(stat, installation_data, InstallationCount)
FillState.objects.create(property=stat.property, end_time=last_end_time,
state=FillState.DONE)
stat = COUNT_STATS['realm_active_humans::day'] stat = COUNT_STATS['realm_active_humans::day']
realm_data = { realm_data = {
None: self.generate_fixture_data(stat, .1, .03, 3, .5, 3, partial_sum=True), None: self.generate_fixture_data(stat, .8, .08, 3, .5, 3, partial_sum=True),
} }
insert_fixture_data(stat, realm_data, RealmCount) insert_fixture_data(stat, realm_data, RealmCount)
installation_data = { installation_data = {
@ -130,11 +142,13 @@ class Command(BaseCommand):
stat = COUNT_STATS['active_users_audit:is_bot:day'] stat = COUNT_STATS['active_users_audit:is_bot:day']
realm_data = { realm_data = {
'false': self.generate_fixture_data(stat, .1, .03, 3.5, .8, 2, partial_sum=True), 'false': self.generate_fixture_data(stat, 1, .2, 3.5, .8, 2, partial_sum=True),
'true': self.generate_fixture_data(stat, .3, .05, 3, .3, 2, partial_sum=True),
} }
insert_fixture_data(stat, realm_data, RealmCount) insert_fixture_data(stat, realm_data, RealmCount)
installation_data = { installation_data = {
'false': self.generate_fixture_data(stat, 1, .3, 6, .8, 2, partial_sum=True), 'false': self.generate_fixture_data(stat, 3, 1, 4, .8, 2, partial_sum=True),
'true': self.generate_fixture_data(stat, 1, .4, 4, .8, 2, partial_sum=True),
} }
insert_fixture_data(stat, installation_data, InstallationCount) insert_fixture_data(stat, installation_data, InstallationCount)
FillState.objects.create(property=stat.property, end_time=last_end_time, FillState.objects.create(property=stat.property, end_time=last_end_time,