diff --git a/routes/__init__.py b/routes/__init__.py index 8ed905c..8b3c96b 100644 --- a/routes/__init__.py +++ b/routes/__init__.py @@ -2,7 +2,6 @@ from flask import Blueprint routes = Blueprint('routes', __name__) from .dashboard import * -from ._search import * from ._matches import * from ._hkfcD_motm import * from ._convenor import * diff --git a/routes/_convenor.py b/routes/_convenor.py index 681f068..4ee6ce6 100644 --- a/routes/_convenor.py +++ b/routes/_convenor.py @@ -1,4 +1,3 @@ -#import MySQLdb import pymysql import os from flask import render_template, request @@ -8,7 +7,7 @@ from dbWrite import sql_read, sql_write, sql_read_static, sql_write_static from forms import addPlayerForm, addTeamForm, addClubForm, playerDbCreateForm, squadListForm from tables import clubList, convenorSquadListTable, convenorFixtureList from . import routes - +from logging import error, info import json BASIC_AUTH_USERNAME = 'admin' @@ -134,9 +133,7 @@ def convenorAddPlayerResult(): _playerNumber = request.form['playerNumber'] _playerTelNumber = request.form['playerTelNumber'] if _team and _playerSurname and _playerHkid and _playerNumber and request.method == 'POST': - sql = "INSERT INTO _" + _club + "_players (playerTeam, playerForenames, playerSurname, playerNickname, playerChineseName, playerEmail, playerDob, playerHkid, playerNumber, playerTelNumber) VALUES ('" + _team + "', '" + _playerForename + "', '" + _playerSurname + "', '" + _playerNickname + "', '" + _playerChineseName_enc + "', '" + _playerEmail + "', '" + _playerDob + "', '" + _playerHkid + "', '" + _playerNumber + "', '" + _playerTelNumber + "')" - print(_team) - print(sql) + sql = "INSERT INTO _" + _club + "_players (playerTeam, playerForenames, playerSurname, playerNickname, playerEmail, playerDob, playerHkid, playerNumber, playerTelNumber) VALUES ('" + _team + "', '" + _playerForename + "', '" + _playerSurname + "', '" + _playerNickname + "', '" + _playerEmail + "', '" + _playerDob + "', '" + _playerHkid + "', '" + _playerNumber + "', '" + _playerTelNumber + "')" sql_write(sql) return render_template('_convenorPlayerAddResults.html', club=_club, firstname=_playerForename, nickname=_playerNickname, surname=_surname, shirt=_playerNumber) except Exception as e: @@ -206,8 +203,6 @@ def convenorDeletePlayer(): @basic_auth.required def convenorEditPlayerResult(): try: -# _year = request.form['year'] - _year = "2018" _club = request.form['playerClub'] _team = request.form['playerTeam'] _playerForename = request.form['playerForenames'] @@ -222,7 +217,7 @@ def convenorEditPlayerResult(): _playerNumber = request.form['playerNumber'] _playerTelNumber = request.form['playerTelNumber'] if _team and _playerSurname and _playerHkid and _playerNumber and request.method == 'POST': - sql = "UPDATE _" + _club + "_players SET playerTeam='" + _team + "', playerForenames='" + _playerForename + "', playerSurname='" + _playerSurname + "', playerNickname='" + _playerNickname + "', playerChineseName='" + _playerChineseName_enc + "', playerEmail='" + _playerEmail + "', playerDob='" + _playerDob + "', playerHkid='" + _playerHkid + "', playerTelNumber='" + _playerTelNumber + "' WHERE playerNumber='" + _playerNumber + "'" + sql = "UPDATE _" + _club + "_players SET playerTeam='" + _team + "', playerForenames='" + _playerForename + "', playerSurname='" + _playerSurname + "', playerNickname='" + _playerNickname + "', playerEmail='" + _playerEmail + "', playerTelNumber='" + _playerTelNumber + "' WHERE playerHkid='" + _playerHkid + "'" sql_write(sql) return render_template('_convenorEditPlayerResults.html', club=_club, firstname=_playerForename, nickname=_playerNickname, surname=_playerSurname, shirt=_playerNumber) except Exception as e: diff --git a/templates/_clubPlayingRecordResults.html b/templates/_clubPlayingRecordResults.html deleted file mode 100644 index 76bb70e..0000000 --- a/templates/_clubPlayingRecordResults.html +++ /dev/null @@ -1,41 +0,0 @@ - - - List of player team appearances from 2018/19 season - Python Flask MySQL app - - - - - - - -

- {% with messages = get_flashed_messages() %} - {% if messages %} -

- {% endif %} - {% endwith %} -

- Home - - - {%- for column in columns %} - - {%- endfor %} - - - - {%- for row in rows %} - - {%- for column in columns %} - - {%- endfor %} - - {%- endfor %} - -
{{ column['Field'] }}
{{ row[column['Field']] }}
- Home - diff --git a/templates/_clubPlayingRecords.html b/templates/_clubPlayingRecords.html deleted file mode 100644 index d4d8640..0000000 --- a/templates/_clubPlayingRecords.html +++ /dev/null @@ -1,70 +0,0 @@ - - - Club Player Playing Record Search *TESTING* - - - - - - -

Search Parameters - select a club to search their playing record

- -
-

- {{ form.csrf_token }} -

-
-
-
-
-
- Season data to search: - {{ form.season(class_="form-control") }} -
-
-
-
-
-
- Club: - {{ form.clubName(class_="form-control") }} -
-
-
-

- {{ form.submitButton(class_="btn btn-success") }} - Cancel -

-
-
- -
-
-
-

-
- - - - diff --git a/templates/_playerCheck.html b/templates/_playerCheck.html deleted file mode 100644 index 1a883bd..0000000 --- a/templates/_playerCheck.html +++ /dev/null @@ -1,70 +0,0 @@ - - - Player Check *TESTING* - - - - - - -

Search Parameters - select a club to search for players who have played for 2 or more teams

- -
-

- {{ form.csrf_token }} -

-
-
-
-
-
- Season data to search: - {{ form.season(class_="form-control") }} -
-
-
-
-
-
- Club: - {{ form.clubName(class_="form-control") }} -
-
-
-

- {{ form.submitButton(class_="btn btn-success") }} - Cancel -

-
-
- -
-
-
-

-
- - - - diff --git a/templates/_playerCheckResults.html b/templates/_playerCheckResults.html deleted file mode 100644 index 76bb70e..0000000 --- a/templates/_playerCheckResults.html +++ /dev/null @@ -1,41 +0,0 @@ - - - List of player team appearances from 2018/19 season - Python Flask MySQL app - - - - - - - -

- {% with messages = get_flashed_messages() %} - {% if messages %} -

- {% endif %} - {% endwith %} -

- Home - - - {%- for column in columns %} - - {%- endfor %} - - - - {%- for row in rows %} - - {%- for column in columns %} - - {%- endfor %} - - {%- endfor %} - -
{{ column['Field'] }}
{{ row[column['Field']] }}
- Home - diff --git a/templates/_playerRecordResults.html b/templates/_playerRecordResults.html deleted file mode 100644 index ad6eba5..0000000 --- a/templates/_playerRecordResults.html +++ /dev/null @@ -1,90 +0,0 @@ - - - List of players from 2018/19 season - Python Flask MySQL app - - - - - - - - - - -

- {% with messages = get_flashed_messages() %} - {% if messages %} -

    - {% for message in messages %} -
  • {{ message }}
  • - {% endfor %} -
- {% endif %} - {% endwith %} -

- - - {%- for column in columns %} - {% if column['Field'] == "playerNumber" %} - - {% elif column['Field'] == "playerName" %} - - {% elif column['Field'] == "appearances" %} - - {% elif column['Field'] == "goals" %} - - {% elif column['Field'].startswith('22381goal') %} - - {% else %} - {%- for match in matchesList %} - {% if column['Field'].startswith(match) %} - {% if column['Field'].endswith('played') %} - - {% elif column['Field'].endswith('goals') %} - - {% elif column['Field'].endswith('capt') %} - - {% endif %} - {% endif %} - {% endfor %} - {% endif %} - {%- endfor %} - - - - {%- for row in rows %} - - {%- for column in columns %} - - {%- endfor %} - - {%- endfor %} - -
Player Number
Player Name
Appearances
Goals
NBC A goals
{{ matches[match] }} Played
{{ matches[match] }} Goals
{{ matches[match] }} Captain
{{ row[column['Field']] }}
- Home - - diff --git a/templates/_playerRecords.html b/templates/_playerRecords.html deleted file mode 100644 index 265b5c9..0000000 --- a/templates/_playerRecords.html +++ /dev/null @@ -1,87 +0,0 @@ - - - Player Playing Record Results Search *TESTING* - - - - - - -

Search Parameters - select both a club and team

- -
-

- {{ form.csrf_token }} -

-
-
-
-
-
- Season data to search: - {{ form.season(class_="form-control") }} -
-
-
-
-
-
- Club: - {{ form.clubName(class_="form-control") }} -
-
-
-
- Team: - {{ form.teamName(class_="form-control") }} -
-
-
-

- {{ form.submitButton(class_="btn btn-success") }} - Cancel -

-
-
- -
-
-
-

-
- - - - diff --git a/templates/_search.html b/templates/_search.html deleted file mode 100644 index 32f4e0c..0000000 --- a/templates/_search.html +++ /dev/null @@ -1,129 +0,0 @@ - - - Team Season Results Search *TESTING* - - - - - - -

Search Parameters - select both a club and team

- -
-

- {{ form.csrf_token }} -

-
-
-
-
-
- Season data to search: - {{ form.season(class_="form-control") }} -
-
-
-
-
-
- Club: - {{ form.clubName(class_="form-control") }} -
-
-
-
- Team: - {{ form.teamName(class_="form-control") }} -
-
-
-
-
-
- Start Date: - {{ form.startDate(class_="form-control") }} -
-
-
-
- End Date: - {{ form.endDate(class_="form-control") }} -
-
-
-

- {{ form.submitButton(class_="btn btn-success") }} - Cancel -

-
-
- -
-
-
-

-
- - - - diff --git a/templates/_searchResults.html b/templates/_searchResults.html deleted file mode 100644 index 5b20ab5..0000000 --- a/templates/_searchResults.html +++ /dev/null @@ -1,26 +0,0 @@ - - - List of matches from 2018/19 season - Python Flask MySQL CRUD - - - - - - - -

- {% with messages = get_flashed_messages() %} - {% if messages %} -

    - {% for message in messages %} -
  • {{ message }}
  • - {% endfor %} -
- {% endif %} - {% endwith %} -

- - {{ table }} -
- Home - diff --git a/templates/_teamRecordResults.html b/templates/_teamRecordResults.html deleted file mode 100644 index f381b17..0000000 --- a/templates/_teamRecordResults.html +++ /dev/null @@ -1,26 +0,0 @@ - - - Team Results from 2018/19 season - Python Flask MySQL app - - - - - - - -

- {% with messages = get_flashed_messages() %} - {% if messages %} -

    - {% for message in messages %} -
  • {{ message }}
  • - {% endfor %} -
- {% endif %} - {% endwith %} -

- - {{ table }} -
- Home - diff --git a/templates/_teamRecords.html b/templates/_teamRecords.html deleted file mode 100644 index b2214d4..0000000 --- a/templates/_teamRecords.html +++ /dev/null @@ -1,85 +0,0 @@ - - - Team Results Record Search *TESTING* - - - - - - -

Search Parameters - select both a club and team

- -
-

- {{ form.csrf_token }} -

-
-
-
-
-
- Season data to search: - {{ form.season(class_="form-control") }} -
-
-
-
- Club: - {{ form.clubName(class_="form-control") }} -
-
-
-
- Team: - {{ form.teamName(class_="form-control") }} -
-
-
-

- {{ form.submitButton(class_="btn btn-success") }} - Cancel -

-
-
- -
-
-
-

-
- - - - diff --git a/templates/dashboard.html b/templates/dashboard.html index b9e4df6..fa1289e 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -12,18 +12,6 @@ Dashboard {% block body %}