def rdelete(): result = ridersClass(dsn = app.config['dsn']) now = datetime.datetime.now() if 'deldefault' in request.form: NAME = request.form['name'] SURNAME = request.form['surname'] result.del_rider_default(NAME, SURNAME) elif 'delbynum' in request.form: NUM = request.form['num'] result.del_rider_by_num(NUM) return render_template('/riders/delete.html', result=result.load_riders(), current_time=now.ctime())
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())
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())
def fadd(): riders = ridersClass(dsn = app.config['dsn']) personal = personalClass(dsn = app.config['dsn']) result = fansClass(dsn = app.config['dsn']) now = datetime.datetime.now() if 'adddefault' in request.form: NAME = request.form['name'] SURNAME = request.form['surname'] MAIL = request.form['mail'] BIRTH = request.form['birth'] FANSID = request.form['fansid'] result.add_fans_default(NAME, SURNAME, MAIL, BIRTH, FANSID) return render_template('/riders/addfan.html', riders=riders.load_riders(), personal=personal.load_personal(), current_time=now.ctime())
def rsearch(): result = ridersClass(dsn = app.config['dsn']) now = datetime.datetime.now() if 'searchdefault' in request.form: NAME = request.form['name'] SURNAME = request.form['surname'] TEAM = request.form['team'] BRAND = request.form['brand'] MODEL = request.form['model'] NATION = request.form['nation'] return render_template('/riders/search.html', result=result.search_rider_default(NAME,SURNAME, TEAM, BRAND, MODEL, NATION), current_time=now.ctime()) elif request.method == 'GET': return render_template('/riders/search.html', result=result.load_riders(), current_time=now.ctime()) return render_template('/riders/search.html', result=result.load_riders(), current_time=now.ctime())
def radd(): result = ridersClass(dsn = app.config['dsn']) now = datetime.datetime.now() if 'adddefault' in request.form: NAME = request.form['name'] SURNAME = request.form['surname'] AGE = request.form['age'] GENDER = request.form['gender'] TEAM = request.form['team'] BRAND = request.form['brand'] MODEL = request.form['model'] NATION = request.form['nation'] YEARS = request.form['years'] BIKENO = request.form['bikeno'] result.add_rider_default(NAME, SURNAME, AGE, GENDER, TEAM, BRAND, MODEL, NATION, YEARS, BIKENO) return render_template('/riders/add.html', result=result.load_riders(), current_time=now.ctime())
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())
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())
def fans(): riders = ridersClass(dsn = app.config['dsn']) personal = personalClass(dsn = app.config['dsn']) result = fansClass(dsn = app.config['dsn']) now = datetime.datetime.now() if 'adddefault' in request.form: NAME = request.form['name'] SURNAME = request.form['surname'] MAIL = request.form['mail'] BIRTH = request.form['birth'] FANSID = request.form['fansid'] result.add_fans_default(NAME, SURNAME, MAIL, BIRTH, FANSID) elif 'updatebymail' in request.form: CMAIL = request.form['cmail'] NAME = request.form['name'] SURNAME = request.form['surname'] MAIL = request.form['mail'] BIRTH = request.form['birth'] result.update_fans_by_mail(NAME, SURNAME, MAIL, BIRTH, CMAIL) elif 'updatebynum' in request.form: NUM = request.form['num'] NAME = request.form['name'] SURNAME = request.form['surname'] MAIL = request.form['mail'] BIRTH = request.form['birth'] FANSID = request.form['fansid'] result.update_fans_by_rider(NUM, NAME, SURNAME, MAIL, BIRTH, FANSID) elif 'searchdefault' in request.form: NAME = request.form['name'] SURNAME = request.form['name'] MAIL = request.form['mail'] FANSID = request.form['fansid'] return render_template('/riders/fans.html', result=result.search_fans_default(NAME, SURNAME, MAIL, FANSID),riders=riders.load_riders(), personal=personal.load_personal(), current_time=now.ctime()) elif 'delbymail' in request.form: MAIL = request.form['mail'] result.del_fans_by_mail(MAIL) elif 'delbynum' in request.form: NUM = request.form['num'] result.del_fans_by_num(NUM) return render_template('/riders/fans.html', result=result.load_fans(),riders=riders.load_riders(), personal=personal.load_personal(), current_time=now.ctime())
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'))
def personal(): riders = ridersClass(dsn = app.config['dsn']) result = personalClass(dsn = app.config['dsn']) now = datetime.datetime.now() if 'adddefault' in request.form: BIRTH = request.form['birth'] WEIGHT = request.form['weight'] HEIGHT = request.form['height'] FAVCIR = request.form['favcir'] WEBSITE = request.form['website'] FACEB = request.form['faceb'] TWIT = request.form['twit'] INSTA = request.form['insta'] PERSID = request.form['persid'] result.add_personal_default(BIRTH, WEIGHT, HEIGHT, FAVCIR, WEBSITE, FACEB, TWIT, INSTA, PERSID) elif 'updatebyrider' in request.form: BIRTH = request.form['birth'] WEIGHT = request.form['weight'] HEIGHT = request.form['height'] FAVCIR = request.form['favcir'] WEBSITE = request.form['website'] FACEB = request.form['faceb'] TWIT = request.form['twit'] INSTA = request.form['insta'] PERSID = request.form['persid'] result.update_personal_by_rider(BIRTH, WEIGHT, HEIGHT, FAVCIR, WEBSITE, FACEB, TWIT, INSTA, FANS, PERSID) elif 'searchdefault' in request.form: PERSID = request.form['persid'] return render_template('/riders/personal.html', result=result.search_personal_default(PERSID),riders=riders.load_riders(), current_time=now.ctime()) elif 'delbyrider' in request.form: PERSID = request.form['persid'] result.del_personal_by_rider(PERSID) elif 'delbynum' in request.form: NUM = request.form['num'] result.del_personal_by_num(NUM) return render_template('/riders/personal.html', result=result.load_personal(),riders=riders.load_riders(), current_time=now.ctime())
def rlist(): result = ridersClass(dsn = app.config['dsn']) now = datetime.datetime.now() return render_template('/riders/list.html', result=result.load_riders(), current_time=now.ctime())