Esempio n. 1
0
def dashboard():
    """Allow a user to see their dashboard"""

    total_records =   db.records.find({"user": auth.current_user()['_id']}).count()
    stats = []
    for stat in db.types.find({"user": auth.current_user()['_id']}):
        stat['count'] = db.records.find({"stat" : stat['_id']}).count()
        stats.append(stat)

    return render_template("dashboard.html", records=total_records, stats=stats)
Esempio n. 2
0
def create_stat( name, description, icon=""):
    """Create a new statistic"""

    types = db.types

    types.insert({"name":name, "description":description, "icon": icon, "user" : current_user()['_id'] })