Exemplo n.º 1
0
def dashboard():

    login_user(User.query.get(1))

    args = {
            'gift_card_eligible': True,
            'cashout_ok': True,
            'user_below_silver': current_user.is_below_tier('Silver'),
    }
    return render_template("dashboard.html", **args)
Exemplo n.º 2
0
def community():

    login_user(User.query.get(1))
    most_recent = User.get_most_recent()

    args = {
        'gift_card_eligible': True,
        'cashout_ok': True,
        'user_below_silver': current_user.is_below_tier('Silver'),
        'most_recent': most_recent
    }
    return render_template("community.html", **args)
Exemplo n.º 3
0
def community():

    login_user(User.query.get(1))

    newest_users = User.get_five_newest_users()

    args = {
        'gift_card_eligible': True,
        'cashout_ok': True,
        'user_below_silver': current_user.is_below_tier('Silver'),
        'table_data': newest_users
    }
    return render_template("community.html", **args)
Exemplo n.º 4
0
def dashboard():

    login_user(User.query.get(1))

    points_and_dollars = current_user.get_points_and_dollars()

    args = {
        'points': points_and_dollars['points'],
        'dollars': points_and_dollars['dollars'],
        'gift_card_eligible': True,
        'cashout_ok': True,
        'user_below_silver': current_user.is_below_tier('Silver'),
    }
    return render_template("dashboard.html", **args)
Exemplo n.º 5
0
def community():

    login_user(User.query.get(1))

    users = User.query.order_by(desc(User.signup_date)).limit(5).all()

    args = {
        'gift_card_eligible': True,
        'cashout_ok': True,
        'user_below_silver': current_user.is_below_tier('Silver'),
        'users': users
    }

    return render_template("community.html", **args)
Exemplo n.º 6
0
def community():

    login_user(User.query.get(1))

    result = query_db(
        "SELECT u.user_id, u.display_name, u.tier, u.point_balance, COALESCE(GROUP_CONCAT(r.attribute), '-') as phone_number, COALESCE(r2.attribute, 'Location Unknown') as location FROM ohm_assessment.user u LEFT JOIN ohm_assessment.rel_user_multi r ON (u.user_id = r.user_id AND r.rel_lookup='PHONE') LEFT JOIN ohm_assessment.rel_user r2 ON (u.user_id = r2.user_id AND r2.rel_lookup='LOCATION') GROUP BY u.user_id ORDER BY signup_date DESC LIMIT 5"
    )
    data = json.dumps(result)

    args = {
        'gift_card_eligible': True,
        'cashout_ok': True,
        'user_below_silver': current_user.is_below_tier('Silver'),
        'resp': Markup(data)
    }

    return render_template("community.html", **args)
Exemplo n.º 7
0
def recent_users():

    login_user(User.query.get(1))
    sql = text("select dn, tier, balance, rel_user_multi.attribute from "
               "(select user.display_name as dn, user_id as uid, user.tier as tier,"
               " user.point_balance as balance from user ORDER BY user.signup_date DESC LIMIT 5)"
               " as recent_user left join rel_user_multi on recent_user.uid = rel_user_multi.user_id ")

    result = db.engine.execute(sql)
    users_data = []
    for row in result:
        ruser = {"display_name": row[0], "tier": row[1], "point_balance": row[2], "phone": row[3]}
        users_data.append(ruser)
    args = {
            'gift_card_eligible': True,
            'cashout_ok': True,
            'user_below_silver': current_user.is_below_tier('Silver'),
            'users': users_data
    }
    return render_template("recent_users.html", **args)