def gen_stat_users(self): stat_time = StatTime(self.start_day, self.end_day) for usr, play_info in self.users_info.users.items(): count_with_indx = play_info.count_with_index() for index, count in count_with_indx.items(): stat_time.stat_count_by_index(int(index)) return stat_time
def __init__(self, start_day, end_day): self.start_day = start_day self.end_day = end_day self.stat_time = StatTime(start_day, end_day) self.users_info = UsersInfo() self.top_num = 30 self.top_values = [0 for i in range(self.top_num)] self.top_users = ['' for i in range(self.top_num)]
def gen_stat_users_by_model_per_day(self): models = {} for usr, play_info in self.users_info.users.items(): m = usr[0:24] count_with_indx = play_info.count_with_index() stat_time = None if m in models: stat_time = models[m] else: stat_time = StatTime(self.start_day, self.end_day) models[m] = stat_time for index, count in count_with_indx.items(): stat_time.stat_count_by_index(int(index)) return models
def gen_stat_count_by_vender_per_day(self): from common.vender_info import vender_dict venders = {} for usr, play_info in self.users_info.users.items(): infos = play_info.count_with_index_and_vender() for index, vender_info in infos.items(): for vender, count in vender_info.items(): if vender in vender_dict: vender = vender_dict[vender] stat_time = None if vender in venders: stat_time = venders[vender] else: stat_time = StatTime(self.start_day, self.end_day) venders[vender] = stat_time stat_time.stat_count_by_index(int(index), count) return venders