Ejemplo n.º 1
0
def sdelete():
    riders = ridersClass(dsn = app.config['dsn'])
    result = yearstatsClass(dsn = app.config['dsn'])
    now = datetime.datetime.now()
    if 'delbyrider' in request.form:
        STATID = request.form['statid']
        result.del_stats_by_rider(STATID)
    elif 'delbynum' in request.form:
        NUM = request.form['num']
        result.del_stats_by_num(NUM)
    return render_template('/riders/stats/delete.html', result=result.load_stats(),riders=riders.load_riders(), current_time=now.ctime())
Ejemplo n.º 2
0
def ssearch():
    riders = ridersClass(dsn = app.config['dsn'])
    result = yearstatsClass(dsn = app.config['dsn'])
    now = datetime.datetime.now()
    if 'searchdefault' in request.form:
        YEAR = request.form['year']
        POSITION = request.form['position']
        return render_template('/riders/stats/search.html', result=result.search_stats_default(YEAR, POSITION),riders=riders.load_riders(), current_time=now.ctime())
    elif 'searchbyrider' in request.form:
        STATID = request.form['statid']
        return render_template('/riders/stats/search.html', result=result.search_stats_by_rider(STATID),riders=riders.load_riders(), current_time=now.ctime())
    return render_template('/riders/stats/search.html', result=result.load_stats(),riders=riders.load_riders(), current_time=now.ctime())
Ejemplo n.º 3
0
def sadd():
    riders = ridersClass(dsn = app.config['dsn'])
    result = yearstatsClass(dsn = app.config['dsn'])
    now = datetime.datetime.now()
    if 'adddefault' in request.form:
        YEAR = request.form['year']
        RACES = request.form['races']
        VICTORY = request.form['victory']
        SECOND = request.form['second']
        THIRD = request.form['third']
        PODIUM = str(int(VICTORY)+int(SECOND)+int(THIRD))
        POLE = request.form['pole']
        POINTS = request.form['points']
        POSITION= request.form['position']
        STATID = request.form['statid']
        result.add_stats_default(YEAR, RACES, VICTORY, SECOND, THIRD, PODIUM, POLE, POINTS, POSITION, STATID)
    return render_template('/riders/stats/add.html', result=result.load_stats(),riders=riders.load_riders(), current_time=now.ctime())
Ejemplo n.º 4
0
def stats():
    riders = ridersClass(dsn = app.config['dsn'])
    result = yearstatsClass(dsn = app.config['dsn'])
    now = datetime.datetime.now()
    if 'adddefault' in request.form:
        YEAR = request.form['year']
        RACES = request.form['races']
        VICTORY = request.form['victory']
        SECOND = request.form['second']
        THIRD = request.form['third']
        PODIUM = str(int(VICTORY)+int(SECOND)+int(THIRD))
        POLE = request.form['pole']
        POINTS = request.form['points']
        POSITION= request.form['position']
        STATID = request.form['statid']
        result.add_stats_default(YEAR, RACES, VICTORY, SECOND, THIRD, PODIUM, POLE, POINTS, POSITION, STATID)
    elif 'updatebynum' in request.form:
        NUM = request.form['num']
        YEAR = request.form['year']
        RACES = request.form['races']
        VICTORY = request.form['victory']
        SECOND = request.form['second']
        THIRD = request.form['third']
        PODIUM = str(int(VICTORY)+int(SECOND)+int(THIRD))
        POLE = request.form['pole']
        POINTS = request.form['points']
        POSITION= request.form['position']
        STATID = request.form['statid']
        result.update_stats_by_num(NUM, YEAR, RACES, VICTORY, SECOND, THIRD, PODIUM, POLE, POINTS, POSITION, STATID)
    elif 'searchdefault' in request.form:
        YEAR = request.form['year']
        POSITION = request.form['position']
        return render_template('/riders/stats.html', result=result.search_stats_default(YEAR, POSITION), riders=riders.load_riders(), current_time=now.ctime())
    elif 'searchbyrider' in request.form:
        STATID = request.form['statid']
        return render_template('/riders/stats.html', result=result.search_stats_by_rider(STATID),riders=riders.load_riders(), current_time=now.ctime())
    elif 'delbyrider' in request.form:
        STATID = request.form['statid']
        result.del_stats_by_rider(STATID)
    elif 'delbynum' in request.form:
        NUM = request.form['num']
        result.del_stats_by_num(NUM)
    return render_template('/riders/stats.html', result=result.load_stats(),riders=riders.load_riders(), current_time=now.ctime())
Ejemplo n.º 5
0
def reset():
    with dbapi2.connect(app.config['dsn']) as connection:
            cursor = connection.cursor()
            query = """DROP TABLE IF EXISTS FANS"""
            cursor.execute(query)
            cursor = connection.cursor()
            query = """DROP TABLE IF EXISTS PERSONAL"""
            cursor.execute(query)
            cursor = connection.cursor()
            query = """DROP TABLE IF EXISTS YEARSTATS"""
            cursor.execute(query)
            cursor = connection.cursor()
            query = """DROP TABLE IF EXISTS RIDERS"""
            cursor.execute(query)
    riders = ridersClass(dsn = app.config['dsn'])
    riders.fill()
    stats = yearstatsClass(dsn = app.config['dsn'])
    stats.fill()
    personal = personalClass(dsn = app.config['dsn'])
    personal.fill()
    fans = fansClass(dsn = app.config['dsn'])
    return redirect(url_for('home_page'))
Ejemplo n.º 6
0
def slist():
    result = yearstatsClass(dsn = app.config['dsn'])
    now = datetime.datetime.now()
    return render_template('/riders/stats/list.html', result=result.load_stats(), current_time=now.ctime())