Adding cookie id - removing motm vote SQL'
This commit is contained in:
parent
a3cfae42b1
commit
d6beb7a040
@ -19,6 +19,9 @@ basic_auth = BasicAuth(app)
|
||||
|
||||
@routes.route('/hkfc-d/motm/<randomUrlSuffix>')
|
||||
def hkfcD_motm_vote(randomUrlSuffix):
|
||||
identity = randomUrlSuffix(8)
|
||||
id_commit = "INSERT INTO motmSessions (sessionID) VALUES (identity))"
|
||||
sql_write(id_commit)
|
||||
sql = "SELECT playerNumber, playerForenames, playerSurname, playerNickname FROM _hkfcD_matchSquad ORDER BY RAND()"
|
||||
sql2 = "SELECT nextClub, nextTeam, nextDate, oppoLogo, hkfcLogo, currMotM, currDotD, nextFixture FROM hkfcDAdminSettings"
|
||||
rows = sql_read(sql)
|
||||
@ -53,7 +56,9 @@ def hkfcD_motm_vote(randomUrlSuffix):
|
||||
randomSuff = urlSuff[0]['motmUrlSuffix']
|
||||
print(randomSuff)
|
||||
if randomSuff == randomUrlSuffix:
|
||||
return render_template('_hkfcDMotmVote.html', data=rows, comment=comment, formatDate=formatDate, matchNumber=nextFixture, oppo=oppo, hkfcLogo=hkfcLogo, oppoLogo=oppoLogo, dotdURL=dotdURL, motmURL=motmURL, form=form)
|
||||
resp = render_template('_hkfcDMotmVote.html', data=rows, comment=comment, formatDate=formatDate, matchNumber=nextFixture, oppo=oppo, hkfcLogo=hkfcLogo, oppoLogo=oppoLogo, dotdURL=dotdURL, motmURL=motmURL, form=form)
|
||||
resp.setcookie('sessionID', id_commit)
|
||||
return resp
|
||||
else:
|
||||
return render_template('_error.html')
|
||||
|
||||
@ -236,6 +241,9 @@ def hkfcD_vote_thanks():
|
||||
_oppo = request.form['oppo']
|
||||
|
||||
if _motm and _dotd and request.method == 'POST':
|
||||
identity = randomUrlSuffix(8)
|
||||
id_commit = "INSERT INTO motmSessions (sessionID) VALUES (identity))"
|
||||
sql_write(id_commit)
|
||||
sql = "INSERT INTO _hkfc_d_motm (playerNumber, playerName, motmTotal, motm_" + _matchDate + ") SELECT playerNumber, playerNickname, '1', '1' FROM _HKFC_players WHERE playerNumber='" + _motm + "' ON DUPLICATE KEY UPDATE motmTotal = motmTotal + 1, motm_" + _matchDate + " = motm_" + _matchDate + " + 1"
|
||||
sql2 = "INSERT INTO _hkfc_d_motm (playerNumber, playerName, dotdTotal, dotd_" + _matchDate + ") SELECT playerNumber, playerNickname, '1', '1' FROM _HKFC_players WHERE playerNumber='" + _dotd + "' ON DUPLICATE KEY UPDATE dotdTotal = dotdTotal + 1, dotd_" + _matchDate + " = dotd_" + _matchDate + " + 1"
|
||||
if _comments == "":
|
||||
@ -245,10 +253,12 @@ def hkfcD_vote_thanks():
|
||||
else:
|
||||
### The matchDate has been replaced with the matchNumber - this should be corrected at some point (via a fixture table lookup)
|
||||
sql3 = "INSERT INTO _motmComments (_matchDate, opposition, comment) VALUES ('" + _matchDate + "', '" + _oppo + "', '" + _fixed_comments + "')"
|
||||
sql_write(sql3)
|
||||
sql_write(sql)
|
||||
sql_write(sql2)
|
||||
return render_template('_hkfcDVoteThanks.html')
|
||||
#sql_write(sql3)
|
||||
#sql_write(sql)
|
||||
#sql_write(sql2)
|
||||
resp = render_template('_hkfcDVoteThanks.html')
|
||||
resp.setcookie('sessionID', commit_id)
|
||||
return resp
|
||||
else:
|
||||
return 'Ouch ... something went wrong here'
|
||||
except Exception as e:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user