Esempio n. 1
0
def current_period(dictionary):
    dict_2 = dictionary.copy()
    global current_miles
    global current_week_count
    for key in dictionary:
        if key < get_time.LM(0):
            del dict_2[key]
    current_week_count = calc.activity_count(dict_2)
    mile_list = []
    for i in dict_2:
        mile_list.append(float(dict_2[i]['distance_miles']))
    current_miles = sum(mile_list)

    current_run_title_label = []
    for i in list(sorted(dict_2)):
        current_run_title_label.append(dict_2[i]['weekday_short_date'])
    current_run_mile_label = []
    for i in list(sorted(dict_2)):
        current_run_mile_label.append(dict_2[i]['distance_miles'])
    current_run_pace_label = []
    for i in list(sorted(dict_2)):
        current_run_pace_label.append(dict_2[i]['pace'])
    current_run_elapsed_label = []
    for i in list(sorted(dict_2)):
        current_run_elapsed_label.append(str(dict_2[i]['elapsed']))
    current_run_treadmill_label = []
    for i in list(sorted(dict_2)):
        current_run_treadmill_label.append(str(dict_2[i]['treadmill_flagged']))

    print("current run")
    print(current_run_title_label)
    print(current_run_mile_label)
    print(current_run_pace_label)
    print(current_run_elapsed_label)
    print(current_run_treadmill_label)
Esempio n. 2
0
def current_period(dictionary):
    dict_2 = dictionary.copy()
    global current_miles
    global current_week_count
    for key in dictionary:
        if key < get_time.LM(0):
            del dict_2[key]
    current_week_count = calc.activity_count(dict_2)
    mile_list = []
    for i in dict_2:
        mile_list.append(float(dict_2[i]['distance_miles']))
    current_miles = sum(mile_list)

    current_run_title_label = []
    for i in list(sorted(dict_2)):
        current_run_title_label.append(dict_2[i]['weekday_full_date'])
    current_run_mile_label = []
    for i in list(sorted(dict_2)):
        current_run_mile_label.append(dict_2[i]['distance_miles'])
    current_run_pace_label = []
    for i in list(sorted(dict_2)):
        current_run_pace_label.append(dict_2[i]['pace'])
    current_run_elapsed_label = []
    for i in list(sorted(dict_2)):
        current_run_elapsed_label.append(str(dict_2[i]['elapsed']))
    current_run_partner_label = []
    for i in list(sorted(dict_2)):
        current_run_partner_label.append(str(dict_2[i]['athlete_count']))

    # print("current run")
    # print(current_run_title_label)
    # print(current_run_mile_label)
    # print(current_run_pace_label)
    # print(current_run_elapsed_label)
    # print(current_run_partner_label)

    label7= v['label7']
    label7.text = (get_time.convert_weekday_full(get_time.LM(0)) + " - " + get_time.convert_weekday_full(get_time.now()))

    label8= v['label8']
    label8.text = str(current_week_count)

    label9= v['label9']
    label9.text = str(current_miles)

    label10= v['label10']
    label10.text = ("\n".join(current_run_mile_label))

    label11= v['label11']
    label11.text = ("\n".join(current_run_title_label))

    label23= v['label23']
    label23.text = ("\n".join(current_run_pace_label))

    label24= v['label24']
    label24.text = ("\n".join(current_run_elapsed_label))

    label25= v['label25']
    label25.text = ("\n".join(current_run_partner_label))
def current_period(dictionary):
    dict_2 = dictionary.copy()
    global current_miles
    global current_week_count
    for key in dictionary:
        if key < get_time.LM(0):
            del dict_2[key]
    current_week_count = calc.activity_count(dict_2)
    mile_list = []
    for i in dict_2:
        mile_list.append(float(dict_2[i]['distance_miles']))
    current_miles = sum(mile_list)

    current_run_title_label = []
    for i in list(sorted(dict_2)):
        current_run_title_label.append(dict_2[i]['weekday_short_date'])
    current_run_mile_label = []
    for i in list(sorted(dict_2)):
        current_run_mile_label.append(dict_2[i]['distance_miles'])
    current_run_pace_label = []
    for i in list(sorted(dict_2)):
        current_run_pace_label.append(dict_2[i]['pace'])
    current_run_elapsed_label = []
    for i in list(sorted(dict_2)):
        current_run_elapsed_label.append(str(dict_2[i]['elapsed']))
    current_run_treadmill_label = []
    for i in list(sorted(dict_2)):
        current_run_treadmill_label.append(str(dict_2[i]['treadmill_flagged']))

    label20 = v['label20']
    label20.text = (get_time.weekday(get_time.LM(0)) + " " +
                    str(get_time.LM(0).day) + " - " +
                    get_time.weekday(get_time.now()) + " " +
                    str(get_time.now().day))

    # label21= v['label21']
    # label21.text = str(current_week_count)

    label22 = v['label22']
    label22.text = str(current_miles)

    label23 = v['label23']
    label23.text = ("\n".join(current_run_title_label))

    label24 = v['label24']
    label24.text = ("\n".join(current_run_mile_label))

    label25 = v['label25']
    label25.text = ("\n".join(current_run_pace_label))

    label26 = v['label26']
    label26.text = ("\n".join(current_run_elapsed_label))

    label27 = v['label27']
    label27.text = ("\n".join(current_run_treadmill_label))
Esempio n. 4
0
def period(dictionary, Sunday, Monday):

    dict_1 = dictionary.copy()
    #if key is newer than last sunday, remove it
    for key in dictionary:
        if key > get_time.LS(Sunday):
            del dict_1[key]
    for key in dictionary:
        if key < get_time.LM(Monday):
            del dict_1[key]

    past_dict_rev = {
        k: dict_1[k]
        for k in list(reversed(sorted(dict_1.keys())))
    }
    past_dict = {
        k: past_dict_rev[k]
        for k in list(sorted(past_dict_rev.keys()))
    }
    past_run_count = calc.activity_count(past_dict)
    past_mile_list = []
    for i in past_dict:
        past_mile_list.append(float(past_dict[i]['distance_miles']))
    past_miles = ("{0:.2f}".format(sum(past_mile_list)))
    past_ten_percent = ("{0:.2f}".format(float(past_miles) * .1))

    past_run_title_label = []
    for i in list(sorted(past_dict)):
        past_run_title_label.append(past_dict[i]['weekday_short_date'])
    past_run_mile_label = []
    for i in list(sorted(past_dict)):
        past_run_mile_label.append(past_dict[i]['distance_miles'])
    past_run_pace_label = []
    for i in list(sorted(past_dict)):
        past_run_pace_label.append(past_dict[i]['pace'])
    past_run_elapsed_label = []
    for i in list(sorted(past_dict)):
        past_run_elapsed_label.append(str(past_dict[i]['elapsed']))
    past_run_treadmill_label = []
    for i in list(sorted(past_dict)):
        past_run_treadmill_label.append(str(past_dict[i]['treadmill_flagged']))

    remaining(past_ten_percent, past_miles)

    print("past run")
    print(past_run_count)
    print(past_miles)
    print(past_ten_percent)
    print(past_run_title_label)
    print(past_run_mile_label)
    print(past_run_pace_label)
    print(past_run_elapsed_label)
    print(past_run_treadmill_label)
Esempio n. 5
0
def previous_previous_period(dictionary):

    dict_1 = dictionary.copy()
    #if key is newer than last sunday, remove it
    for key in dictionary:
        if key > get_time.LS(0):
            del dict_1[key]
    for key in dictionary:
        if key < get_time.LM(3):
            del dict_1[key]

    past_dict_rev = {k: dict_1[k] for k in list(reversed(sorted(dict_1.keys())))[:8]}
    past_dict = {k: past_dict_rev[k] for k in list(sorted(past_dict_rev.keys()))[:4]}
    past_run_count = calc.activity_count(past_dict)
    past_mile_list = []
    for i in past_dict:
        past_mile_list.append(float(past_dict[i]['distance_miles']))
    past_miles = ("{0:.2f}".format(sum(past_mile_list)))
    past_ten_percent = ("{0:.2f}".format(float(past_miles) * .1))

    past_run_title_label = []
    for i in list(sorted(past_dict)):
        past_run_title_label.append(past_dict[i]['weekday_full_date'])
    past_run_mile_label = []
    for i in list(sorted(past_dict)):
        past_run_mile_label.append(past_dict[i]['distance_miles'])
    past_run_pace_label = []
    for i in list(sorted(past_dict)):
        past_run_pace_label.append(past_dict[i]['pace'])
    past_run_elapsed_label = []
    for i in list(sorted(past_dict)):
        past_run_elapsed_label.append(str(past_dict[i]['elapsed']))
    past_run_partner_label = []
    for i in list(sorted(past_dict)):
        past_run_partner_label.append(str(past_dict[i]['athlete_count']))

    # print("past past run")
    # print(past_run_count)
    # print(past_miles)
    # print(past_ten_percent)
    # print(past_run_title_label)
    # print(past_run_mile_label)
    # print(past_run_pace_label)
    # print(past_run_elapsed_label)
    # print(past_run_partner_label)

    label1= v['label1']
    label1.text = (get_time.convert_weekday_full(get_time.LM(3)) + " - " + get_time.convert_weekday_full(get_time.LS(0)))

    label2= v['label2']
    label2.text = str(past_run_count)

    label3= v['label3']
    label3.text = str(past_miles)

    label4= v['label4']
    label4.text = str(past_ten_percent)

    label5= v['label5']
    label5.text = ("\n".join(past_run_mile_label))

    label6= v['label6']
    label6.text = ("\n".join(past_run_title_label))

    label19= v['label19']
    label19.text = ("\n".join(past_run_pace_label))

    label20= v['label20']
    label20.text = ("\n".join(past_run_elapsed_label))

    label21= v['label21']
    label21.text = ("\n".join(past_run_partner_label))

    remaining_period(past_ten_percent,past_miles)
Esempio n. 6
0
def top_period(dictionary):

    dict_1 = dictionary.copy()

    result = calc.top_running_period(master_dict,4,'distance_miles')
    result_dict = {k: result[k] for k in list(reversed(sorted(result.keys())))[:1]}
    final_dict = dict()
    for i in result_dict.values():
        for w in i:
            final_dict.update({w: i[w]})

    top_run_count = calc.activity_count(final_dict)
    top_mile_list = []
    for i in final_dict:
        top_mile_list.append(float(final_dict[i]['distance_miles']))
    top_miles = ("{0:.2f}".format(sum(top_mile_list)))
    top_ten_percent = ("{0:.2f}".format(float(top_miles) * .1))

    top_run_title_label = []
    for i in list(sorted(final_dict)):
        top_run_title_label.append(final_dict[i]['weekday_full_date'])
    top_run_mile_label = []
    for i in list(sorted(final_dict)):
        top_run_mile_label.append(final_dict[i]['distance_miles'])
    top_run_pace_label = []
    for i in list(sorted(final_dict)):
        top_run_pace_label.append(final_dict[i]['pace'])
    top_run_elapsed_label = []
    for i in list(sorted(final_dict)):
        top_run_elapsed_label.append(str(final_dict[i]['elapsed']))
    top_run_partner_label = []
    for i in list(sorted(final_dict)):
        top_run_partner_label.append(str(final_dict[i]['athlete_count']))

    # print("top period")
    # print(top_run_count)
    # print(top_miles)
    # print(top_ten_percent)
    # print(top_run_title_label)
    # print(top_run_mile_label)
    # print(top_run_pace_label)
    # print(top_run_elapsed_label)
    # print(top_run_partner_label)

    date_list = []
    for key in list(sorted(final_dict)):
        date_list.append(final_dict[key]['start_date_datetime'])
    time1 = date_list[0]
    time2 = date_list[3]

    label1= v['label1']
    label1.text = (get_time.convert_weekday_full(time1) + " - " + get_time.convert_weekday_full(time2))

    label2= v['label2']
    label2.text = str(top_run_count)

    label3= v['label3']
    label3.text = str(top_miles)

    label4= v['label4']
    label4.text = str(top_ten_percent)

    label5= v['label5']
    label5.text = ("\n".join(top_run_mile_label))

    label6= v['label6']
    label6.text = ("\n".join(top_run_title_label))

    label19= v['label19']
    label19.text = ("\n".join(top_run_pace_label))

    label20= v['label20']
    label20.text = ("\n".join(top_run_elapsed_label))

    label21= v['label21']
    label21.text = ("\n".join(top_run_partner_label))

    remaining_period(top_ten_percent,top_miles)
def period(dictionary, Sunday, Monday):

    dict_1 = dictionary.copy()
    for key in dictionary:
        if key > get_time.LS(Sunday):
            del dict_1[key]
    for key in dictionary:
        if key < get_time.LM(Monday):
            del dict_1[key]

    past_dict_rev = {
        k: dict_1[k]
        for k in list(reversed(sorted(dict_1.keys())))
    }
    past_dict = {
        k: past_dict_rev[k]
        for k in list(sorted(past_dict_rev.keys()))
    }
    past_run_count = calc.activity_count(past_dict)
    past_mile_list = []
    for i in past_dict:
        past_mile_list.append(float(past_dict[i]['distance_miles']))
    past_miles = ("{0:.2f}".format(sum(past_mile_list)))
    past_ten_percent = ("{0:.2f}".format(float(past_miles) * .1))

    past_run_title_label = []
    for i in list(sorted(past_dict)):
        past_run_title_label.append(past_dict[i]['weekday_short_date'])
    past_run_mile_label = []
    for i in list(sorted(past_dict)):
        past_run_mile_label.append(past_dict[i]['distance_miles'])
    past_run_pace_label = []
    for i in list(sorted(past_dict)):
        past_run_pace_label.append(past_dict[i]['pace'])
    past_run_elapsed_label = []
    for i in list(sorted(past_dict)):
        past_run_elapsed_label.append(str(past_dict[i]['elapsed']))
    past_run_treadmill_label = []
    for i in list(sorted(past_dict)):
        past_run_treadmill_label.append(str(past_dict[i]['treadmill_flagged']))

    remaining(past_ten_percent, past_miles)

    label1 = v['label1']
    label1.text = (get_time.convert_weekday_full(get_time.LM(Monday)) + " - " +
                   get_time.convert_weekday_full(get_time.LS(Sunday)))

    label2 = v['label2']
    label2.text = str(past_miles)

    # label3= v['label3']
    # label3.text = str(past_run_count)

    label4 = v['label4']
    label4.text = str(past_ten_percent)

    label5 = v['label5']
    label5.text = ("\n".join(past_run_title_label))

    label6 = v['label6']
    label6.text = ("\n".join(past_run_mile_label))

    label7 = v['label7']
    label7.text = ("\n".join(past_run_pace_label))

    label8 = v['label8']
    label8.text = ("\n".join(past_run_elapsed_label))

    label9 = v['label9']
    label9.text = ("\n".join(past_run_treadmill_label))
Esempio n. 8
0
def period(dictionary, Sunday, Monday):

    dict_1 = dictionary.copy()
    for key in dictionary:
        if key > get_time.LS(Sunday):
            del dict_1[key]
    for key in dictionary:
        if key < get_time.LM(Monday):
            del dict_1[key]

    past_dict_rev = {
        k: dict_1[k]
        for k in list(reversed(sorted(dict_1.keys())))
    }
    past_dict = {
        k: past_dict_rev[k]
        for k in list(sorted(past_dict_rev.keys()))
    }
    past_run_count = calc.activity_count(past_dict)
    past_mile_list = []
    for i in past_dict:
        past_mile_list.append(float(past_dict[i]['distance_miles']))
    past_miles = ("{0:.2f}".format(sum(past_mile_list)))
    past_ten_percent = ("{0:.2f}".format(float(past_miles) * .1))

    past_run_title_label = []
    for i in list(sorted(past_dict)):
        past_run_title_label.append(past_dict[i]['weekday_short_date'])
    past_run_mile_label = []
    for i in list(sorted(past_dict)):
        past_run_mile_label.append(past_dict[i]['distance_miles'])
    past_run_pace_label = []
    for i in list(sorted(past_dict)):
        past_run_pace_label.append(past_dict[i]['pace'])
    past_run_elapsed_label = []
    for i in list(sorted(past_dict)):
        past_run_elapsed_label.append(str(past_dict[i]['elapsed']))
    past_run_treadmill_label = []
    for i in list(sorted(past_dict)):
        past_run_treadmill_label.append(
            str(past_dict[i]['total_elevation_feet']))

    remaining(past_ten_percent, past_miles, runs_per_week)

    label1 = v['label1']
    label1.text = (get_time.convert_weekday_full(get_time.LM(Monday)) + " - " +
                   get_time.convert_weekday_full(get_time.LS(Sunday)))

    label2 = v['label2']
    label2.text = str(past_miles)

    # label3= v['label3']
    # label3.text = str(past_run_count)

    label4 = v['label4']
    label4.text = str(past_ten_percent)

    label5 = v['label5']
    label5.text = ("\n".join(past_run_title_label))

    label6 = v['label6']
    label6.text = ("\n".join(past_run_mile_label))

    label7 = v['label7']
    label7.text = ("\n".join(past_run_pace_label))

    label8 = v['label8']
    label8.text = ("\n".join(past_run_elapsed_label))

    label9 = v['label9']
    label9.text = ("\n".join(past_run_treadmill_label))

    #totals at bottom
    dec_pace_list = []
    for i in list(sorted(past_dict)):
        dec_pace_list.append(past_dict[i]['pace_dec'])
    current_pace_average = get_data.convert_dec_time(
        sum(dec_pace_list) / len(dec_pace_list))
    label504 = v['label504']
    label504.text = str(current_pace_average)

    seconds_elapsed_list = []
    for i in list(sorted(past_dict)):
        seconds_elapsed_list.append(past_dict[i]['elapsed_time'])
    total_elapsed_seconds = sum(seconds_elapsed_list)
    current_duration_total = get_data.convert_seconds_to_minutes(
        total_elapsed_seconds)
    label505 = v['label505']
    label505.text = str(current_duration_total)

    current_elevation_list = []
    for i in list(sorted(past_dict)):
        current_elevation_list.append(
            float(past_dict[i]['total_elevation_feet']))
    current_elevation_total = sum(current_elevation_list)
    label506 = v['label506']
    label506.text = str(current_elevation_total)
Esempio n. 9
0
def current_period(dictionary):
    dict_2 = dictionary.copy()
    global current_miles
    global current_week_count
    for key in dictionary:
        if key < get_time.LM(0):
            del dict_2[key]
    current_week_count = calc.activity_count(dict_2)
    mile_list = []
    for i in dict_2:
        mile_list.append(float(dict_2[i]['distance_miles']))
    current_miles = "{0:.2f}".format(sum(mile_list))

    current_run_title_label = []
    for i in list(sorted(dict_2)):
        current_run_title_label.append(dict_2[i]['weekday_short_date'])
    current_run_mile_label = []
    for i in list(sorted(dict_2)):
        current_run_mile_label.append(dict_2[i]['distance_miles'])
    current_run_pace_label = []
    for i in list(sorted(dict_2)):
        current_run_pace_label.append(dict_2[i]['pace'])
    current_run_elapsed_label = []
    for i in list(sorted(dict_2)):
        current_run_elapsed_label.append(str(dict_2[i]['elapsed']))
    current_run_treadmill_label = []
    for i in list(sorted(dict_2)):
        current_run_treadmill_label.append(
            str("{0:.2f}".format(dict_2[i]['total_elevation_feet'])))

    #totals at bottom
    dec_pace_list = []
    for i in list(sorted(dict_2)):
        dec_pace_list.append(dict_2[i]['pace_dec'])
    if len(dec_pace_list) != 0:
        current_pace_average = get_data.convert_dec_time(
            sum(dec_pace_list) / len(dec_pace_list))
    else:
        current_pace_average = 0
    label501 = v['label501']
    label501.text = str(current_pace_average)

    seconds_elapsed_list = []
    for i in list(sorted(dict_2)):
        seconds_elapsed_list.append(dict_2[i]['elapsed_time'])
    total_elapsed_seconds = sum(seconds_elapsed_list)
    current_duration_total = get_data.convert_seconds_to_minutes(
        total_elapsed_seconds)
    label502 = v['label502']
    label502.text = str(current_duration_total)

    current_elevation_list = []
    for i in list(sorted(dict_2)):
        current_elevation_list.append(float(dict_2[i]['total_elevation_feet']))
    current_elevation_total = sum(current_elevation_list)
    label503 = v['label503']
    label503.text = str("{0:.2f}".format(current_elevation_total))

    label20 = v['label20']
    label20.text = (get_time.weekday(get_time.LM(0)) + " " +
                    str(get_time.LM(0).day) + " - " +
                    get_time.weekday(get_time.now()) + " " +
                    str(get_time.now().day))

    # label21= v['label21']
    # label21.text = str(current_week_count)

    label22 = v['label22']
    label22.text = str(current_miles)

    label23 = v['label23']
    label23.text = ("\n".join(current_run_title_label))

    label24 = v['label24']
    label24.text = ("\n".join(current_run_mile_label))

    label25 = v['label25']
    label25.text = ("\n".join(current_run_pace_label))

    label26 = v['label26']
    label26.text = ("\n".join(current_run_elapsed_label))

    label27 = v['label27']
    label27.text = ("\n".join(current_run_treadmill_label))