Ejemplo n.º 1
0
def generate_statistics():
    # 每日指标只显示最近一周的
    now_date = datetime.date.today()
    now_date_str = datetime.date.today().strftime('%Y-%m-%d')
    day_norm_start_str = get_before_date(now_date, 8).strftime('%Y-%m-%d')
    result_date_day_norm, result_data_day_norm = user_growth_info(day_norm_start_str, now_date_str, 'day')

    # 每周指标只显示最近一个月的
    week_norm_start_str = get_before_date(now_date, 30).strftime('%Y-%m-%d')
    result_date_week_norm, result_data_week_norm = user_growth_info(week_norm_start_str, now_date_str, 'week')
    return result_date_day_norm, result_data_day_norm, result_date_week_norm, result_data_week_norm
Ejemplo n.º 2
0
def norm_index_work():
    start_date = request.form['startDay']
    end_date = request.form['endDay']
    index_type = request.form['indextype']
    time_choose = request.form['timeChoose']

    result_date, result_data = user_growth_info(start_date, end_date, time_choose)

    # if time_choose == u'day':
    #     date_list, day_norm_dict = get_day_norms(start_date, end_date)
    #     norm_data = day_norm_dict[norm_map[str(index_type)]]
    # elif time_choose == u'week':
    #     date_list, week_norm_dict = get_week_norms(start_date, end_date)
    #     norm_data = week_norm_dict[norm_map[str(index_type)]]
    # else:
    #     date_list, global_norm_dict = get_global_norms(start_date, end_date)
    #     norm_data = global_norm_dict[norm_map[str(index_type)]]

    return jsonify({'date_list': result_date, 'norm_data': result_data[norm_map[str(index_type)]]})