36 lines
1.5 KiB
Python
36 lines
1.5 KiB
Python
#import MySQLdb
|
|
import pymysql
|
|
from dbWrite import sql_read, sql_read_static
|
|
from flask import render_template, request, jsonify
|
|
from forms import searchForm, playerRecordsForm, teamRecordsForm, clubPlayingRecordsForm
|
|
from . import routes
|
|
from tables import Results, matchCardHome, matchCardAway
|
|
import datetime
|
|
from datetime import date
|
|
|
|
|
|
@routes.route('/matches/')
|
|
def matchDetails():
|
|
return 'hello'
|
|
|
|
@routes.route('/matches/<id>')
|
|
def matchLookup(id):
|
|
sql = "SELECT * FROM _mensResults WHERE matchNumber=" + id + ""
|
|
matchDetails = sql_read(sql)
|
|
matchTable = Results(matchDetails)
|
|
matchTable.border = True
|
|
matchTable.classes = ['table-striped', 'table-condensed', 'table-hover']
|
|
home = matchDetails[0]['matchHomeClub'].lower() + matchDetails[0]['matchHomeTeam']
|
|
away = matchDetails[0]['matchAwayClub'].lower() + matchDetails[0]['matchAwayTeam']
|
|
sql2 = "SELECT playerNumber, playerName, " + id + "goals, " + id + "capt FROM _" + home + " WHERE " + id + "played=1"
|
|
sql3 = "SELECT playerNumber, playerName, " + id + "goals, " + id + "capt FROM _" + away + " WHERE " + id + "played=1"
|
|
homeCard = sql_read(sql2)
|
|
homeTable = matchCardHome(homeCard)
|
|
homeTable.border = True
|
|
homeTable.classes = ['table-striped', 'table-condensed', 'table-hover']
|
|
awayCard = sql_read(sql3)
|
|
awayTable = matchCardAway(awayCard)
|
|
awayTable.border = True
|
|
awayTable.classes = ['table-striped', 'table-condensed', 'table-hover']
|
|
return render_template('_matchDetails.html', matchTable=matchTable, homeTable=homeTable, awayTable=awayTable)
|