def submit(): player = request.args.get('player_name').strip(); pnum = request.args.get('p_num'); mode = request.args.get('mode') print(player) #print(crc(player)) #print(pnum) print(session['username']) print(session['score']) if crc(player) == int(pnum): session['score'] += 1 session['max_streak'] = session['score'] session['most_recent_nonzero_score'] = session['score'] if mode == 'all': table, player_name = pick_all_years() table = percentiles.percentalize([[HEADERS[0]] + HEADERS[5:]] + table) print(player_name) return jsonify(successCode = '1', pnum = crc(player_name), stats = render_template("table.html", headers = [HEADERS[0]] + HEADERS[5:], table=table)) else: table, player_name = pick_a_year() table = percentiles.percentalize([HEADERS] + table) print(player_name) return jsonify(successCode = '1', pnum = crc(player_name), stats = render_template("table.html", headers = HEADERS, table=table)) else: session['most_recent_nonzero_score'] = session['score'] session['score'] = 0 return jsonify(successCode = '0')
def hello_world(): #sid = _generate_sid #MODE = 'one' try: if not session['username']: print(session['username'], ' is the session username') session['username'] = _generate_sid() except: print('NO SESSIONS USERNAME! generating a new one') session['username'] = _generate_sid() try: max_streak = session['max_streak'] except: max_streak = 0 print(max_streak) session['score'] = 0 session['most_recent_nonzero_score'] = 0 table, player_name = pick_a_year() print(HEADERS + table) table = percentiles.percentalize([HEADERS] + table) print(table) pnum = crc(player_name) return render_template("index.html", mode = 'one', headers = HEADERS, table=table, pnum=pnum, names=[player[:-5] for player in players], max_streak = max_streak)
def crack(): print(leaderboard.leaderboard) #MODE = 'all' ###### try: if not session['username']: print(session['username'], ' is the session username') session['username'] = _generate_sid() except: print('NO SESSIONS USERNAME! generating a new one') session['username'] = _generate_sid() try: max_streak = session['max_streak'] except: max_streak = 0 #### table, player_name = pick_all_years() table = percentiles.percentalize([[HEADERS[0]] + HEADERS[5:]] + table) pnum = crc(player_name) return render_template("index.html", mode='all', headers=[HEADERS[0]] + HEADERS[5:], table=table, pnum=pnum, names=[player[:-5] for player in players], max_streak=max_streak)
def hello_world(): #sid = _generate_sid #MODE = 'one' try: if not session['username']: print(session['username'], ' is the session username') session['username'] = _generate_sid() except: print('NO SESSIONS USERNAME! generating a new one') session['username'] = _generate_sid() try: max_streak = session['max_streak'] except: max_streak = 0 print(max_streak) session['score'] = 0 session['most_recent_nonzero_score'] = 0 table, player_name = pick_a_year() print(HEADERS + table) table = percentiles.percentalize([HEADERS] + table) print(table) pnum = crc(player_name) return render_template("index.html", mode='one', headers=HEADERS, table=table, pnum=pnum, names=[player[:-5] for player in players], max_streak=max_streak)
def giveup(): session['most_recent_nonzero_score'] = session['score'] session['score'] = 0 pnum = request.args.get('p_num') mode = request.args.get('mode') old_player_name = hashdict[pnum] if mode == 'all': table, player_name = pick_all_years() theaders = [HEADERS[0]] + HEADERS[5:] else: table, player_name = pick_a_year() theaders = HEADERS table = percentiles.percentalize([theaders] + table) return jsonify(pnum = crc(player_name), player_name = old_player_name, stats = render_template("table.html", headers = theaders, table=table))
def submit(): player = request.args.get('player_name').strip() pnum = request.args.get('p_num') mode = request.args.get('mode') print(player) #print(crc(player)) #print(pnum) print(session['username']) print(session['score']) if crc(player) == int(pnum): session['score'] += 1 session['max_streak'] = session['score'] session['most_recent_nonzero_score'] = session['score'] if mode == 'all': table, player_name = pick_all_years() table = percentiles.percentalize([[HEADERS[0]] + HEADERS[5:]] + table) print(player_name) return jsonify(successCode='1', pnum=crc(player_name), stats=render_template("table.html", headers=[HEADERS[0]] + HEADERS[5:], table=table)) else: table, player_name = pick_a_year() table = percentiles.percentalize([HEADERS] + table) print(player_name) return jsonify(successCode='1', pnum=crc(player_name), stats=render_template("table.html", headers=HEADERS, table=table)) else: session['most_recent_nonzero_score'] = session['score'] session['score'] = 0 return jsonify(successCode='0')
def crack_with_name(playernum=None): print(playernum, hashdict[playernum]) try: if not session['username']: print(session['username'], ' is the session username') session['username'] = _generate_sid() except: print('NO SESSIONS USERNAME! generating a new one') session['username'] = _generate_sid() try: max_streak = session['max_streak'] except: max_streak = 0 #### table, player_name = pick_all_years(player = hashdict[playernum]) table = percentiles.percentalize([[HEADERS[0]] + HEADERS[5:]] + table) pnum = crc(player_name) return render_template("index.html", mode = 'all', headers = [HEADERS[0]] + HEADERS[5:], table=table, pnum=pnum, names=[player[:-5] for player in players], max_streak = max_streak)
def giveup(): session['most_recent_nonzero_score'] = session['score'] session['score'] = 0 pnum = request.args.get('p_num') mode = request.args.get('mode') old_player_name = hashdict[pnum] if mode == 'all': table, player_name = pick_all_years() theaders = [HEADERS[0]] + HEADERS[5:] else: table, player_name = pick_a_year() theaders = HEADERS table = percentiles.percentalize([theaders] + table) return jsonify(pnum=crc(player_name), player_name=old_player_name, stats=render_template("table.html", headers=theaders, table=table))