def teams(): global conn, cur conn = db.connect_db() cur = conn.cursor(cursor_factory=RealDictCursor) cur.execute('select timestamp from match order by timestamp desc limit 1') result = cur.fetchall() return render_template('teams.html', mod=mod, timestamp=result[0]['timestamp'])
def get_teams(): player = request.form.get('player') global conn, cur conn = db.connect_db() cur = conn.cursor(cursor_factory=RealDictCursor) if player == None or player == '': cur.execute('select * from team order by wlratio desc, played desc') else: cur.execute('select * from team where %s = any(players) order by wlratio desc, played desc', (player,)) return jsonify(data=cur.fetchall())