Example #1
0
def user_data(username=None):
    if username is None:
        return "No such user!", 520

    mpts = db_ops.all_weights_and_dates_get(username)

    if len(mpts) == 0:
        return "Missing data!", 520

    retval = "<title>{}</title>".format(username)
    retval = "<h1>{}</h1>".format(username)
    retval += tablemaker(["weight", "date"], mpts)

    return retval
Example #2
0
def user_data(username=None):
    if username is None:
        return "No such user!", 520

    mpts = db_ops.all_weights_and_dates_get(username)

    if len(mpts) == 0:
        return "Missing data!", 520

    retval  = "<title>{}</title>".format(username)
    retval  = "<h1>{}</h1>".format(username)
    retval += tablemaker(["weight", "date"], mpts)

    return retval
Example #3
0
def user_graph(username=None):
    if username is None:
        return "No such user!", 520

    mpts = db_ops.all_weights_and_dates_get(username)

    if len(mpts) == 0:
        return "Missing data!", 520

    template_array = u""
    for pt in mpts:
        template_array += u"[new Date({}, {}, {}),{}],".format( pt.date.year,
                                                                pt.date.month-1,    # Google month items are zero indexed
                                                                pt.date.day,
                                                                pt.weight_lbs )
    # Remove the trailing comma from the loop
    template_array=template_array.rstrip(',')

    return render_template('usergraph.html', username=username, date_wgt_array=template_array)
Example #4
0
def user_graph(username=None):
    if username is None:
        return "No such user!", 520

    mpts = db_ops.all_weights_and_dates_get(username)

    if len(mpts) == 0:
        return "Missing data!", 520

    template_array = u""
    for pt in mpts:
        template_array += u"[new Date({}, {}, {}),{}],".format(
            pt.date.year,
            pt.date.month - 1,  # Google month items are zero indexed
            pt.date.day,
            pt.weight_lbs)
    # Remove the trailing comma from the loop
    template_array = template_array.rstrip(',')

    return render_template('usergraph.html',
                           username=username,
                           date_wgt_array=template_array)