def generate_statistics(i, versions, channels, year): year = year if i % 100 == 0: print(('=> %s' % i)) version = random.choice(versions) platform = version.platform.name if getattr(version, 'platform', None) else 'mac' channel = random.choice(channels) if platform != 'mac': app = create_app_xml(appid=version.app.id, version=str(version.version), tag=channel.name, events=[random.choice(events)]) app_list = [app] else: app_list = dict(appid=version.app.id, version=str(version.short_version), tag=version.channel) month = random.choice(list(range(1, 13))) day = random.choice(list(range(1, 28))) date = datetime(year, month, day) userid = get_random_uuid(platform) if platform == 'mac': mac_userid_counting(userid, app_list, platform, now=date) else: userid_counting(userid, app_list, platform, now=date)
def _generate_fake_statistics(self): now = datetime.now() prev_year = now.year - 1 for i in range(1, 13): date = datetime(year=prev_year, month=i, day=10) for id in range(1, i + 1): user_id = UUID(int=id) userid_counting(user_id, self.install_app_list, self.platform.name, now=date) user_id = UUID(int=1000 + id) mac_userid_counting(user_id, self.mac_app, 'mac', now=date) userid_counting(UUID(int=i), self.uninstall_app_list, self.platform.name, now=date) user_id = UUID(int=13) userid_counting(user_id, self.install_app_list, self.platform.name, now=datetime(year=now.year, month=1, day=1)) userid_counting(user_id, self.uninstall_app_list, self.platform.name, now=datetime(year=now.year, month=1, day=1)) user_id = UUID(int=1013) mac_userid_counting(user_id, self.mac_app, 'mac', now=datetime(year=now.year, month=1, day=1))
def generate_statistics(i, versions, channels, year): year = year if i % 100 == 0: print(('=> %s' % i)) version = random.choice(versions) platform = version.platform.name if getattr(version, 'platform', None) else 'mac' channel = random.choice(channels) if platform != 'mac': app = create_app_xml(appid=version.app.id, version=str(version.version), tag=channel.name, events=[random.choice(events)]) app_list = [app] else: app_list = dict( appid=version.app.id, version=str(version.short_version), tag=version.channel ) month = random.choice(list(range(1, 13))) day = random.choice(list(range(1, 28))) date = datetime(year, month, day) userid = get_random_uuid(platform) if platform == 'mac': mac_userid_counting(userid, app_list, platform, now=date) else: userid_counting(userid, app_list, platform, now=date)
def _generate_fake_statistics(self): now = datetime.now() year = now.year n_users = 12 for i in range(1, n_users + 1): date = datetime(year=year, month=i, day=10) for id in range(1, i + 1): user_id = UUID(int=id) userid_counting(user_id, self.install_app_list, self.platform.name, now=date) user_id = UUID(int=n_users + id) mac_userid_counting(user_id, self.mac_app, "mac", now=date) userid_counting(UUID(int=i), self.uninstall_app_list, self.platform.name, now=date)
def _generate_fake_statistics(self): now = datetime.now() year = now.year n_users = 12 for i in range(1, n_users+1): date = datetime(year=year, month=i, day=10) for id in range(1, i + 1): user_id = UUID(int=id) userid_counting(user_id, self.install_app_list, self.platform.name, now=date) user_id = UUID(int=n_users + id) mac_userid_counting(user_id, self.mac_app, 'mac', now=date) userid_counting(UUID(int=i), self.uninstall_app_list, self.platform.name, now=date)