Fix indents
This commit is contained in:
parent
5f1e4eedc8
commit
1c1b0e6f05
@ -310,9 +310,10 @@ def hkfcD_vote_chicken():
|
|||||||
if prev_identity:
|
if prev_identity:
|
||||||
vote_query = "SELECT dotd_" + _matchDate + " FROM motmSessions WHERE sessionID='" + prev_identity + "'"
|
vote_query = "SELECT dotd_" + _matchDate + " FROM motmSessions WHERE sessionID='" + prev_identity + "'"
|
||||||
vote_check = sql_read(vote_query)
|
vote_check = sql_read(vote_query)
|
||||||
if not vote_check:
|
if not vote_check:
|
||||||
warn('Cookie exists but no record in DB - check: '+prev_identity)
|
warn('Cookie exists but no record in DB - check: '+prev_identity)
|
||||||
return render_template('_hkfcDSmithersFail.html', sessionID=prev_identity)
|
return render_template('_hkfcDSmithersFail.html', sessionID=prev_identity)
|
||||||
|
else:
|
||||||
vote_valid = vote_check[0]['dotd_' + _matchDate ]
|
vote_valid = vote_check[0]['dotd_' + _matchDate ]
|
||||||
if vote_valid:
|
if vote_valid:
|
||||||
warn("Naughty, naughty, you've already voted!")
|
warn("Naughty, naughty, you've already voted!")
|
||||||
@ -329,7 +330,7 @@ def hkfcD_vote_chicken():
|
|||||||
elif _comments == "Optional comments added here":
|
elif _comments == "Optional comments added here":
|
||||||
print("No comment")
|
print("No comment")
|
||||||
else:
|
else:
|
||||||
### The matchDate has been replaced with the matchNumber - this should be corrected at some point (via a fixture table lookup)
|
### 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 + "')"
|
sql3 = "INSERT INTO _motmComments (_matchDate, opposition, comment) VALUES ('" + _matchDate + "', '" + _oppo + "', '" + _fixed_comments + "')"
|
||||||
sql_write(sql3)
|
sql_write(sql3)
|
||||||
sql_write(sql)
|
sql_write(sql)
|
||||||
@ -340,29 +341,28 @@ def hkfcD_vote_chicken():
|
|||||||
|
|
||||||
resp.set_cookie('sessionID', prev_identity, expires=expire_date)
|
resp.set_cookie('sessionID', prev_identity, expires=expire_date)
|
||||||
return resp
|
return resp
|
||||||
|
else:
|
||||||
|
identity = randomUrlSuffix(8)
|
||||||
|
id_commit = "INSERT INTO motmSessions (sessionID) VALUES ('" + identity + "')"
|
||||||
|
ua_commit = "INSERT INTO motmSessions (userAgent) VALUES ('" + user_agent + "')"
|
||||||
|
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 == "":
|
||||||
|
print("No comment")
|
||||||
|
elif _comments == "Optional comments added here":
|
||||||
|
print("No comment")
|
||||||
else:
|
else:
|
||||||
identity = randomUrlSuffix(8)
|
|
||||||
id_commit = "INSERT INTO motmSessions (sessionID) VALUES ('" + identity + "')"
|
|
||||||
ua_commit = "INSERT INTO motmSessions (userAgent) VALUES ('" + user_agent + "')"
|
|
||||||
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 == "":
|
|
||||||
print("No comment")
|
|
||||||
elif _comments == "Optional comments added here":
|
|
||||||
print("No comment")
|
|
||||||
else:
|
|
||||||
### The matchDate has been replaced with the matchNumber - this should be corrected at some point (via a fixture table lookup)
|
### 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 + "')"
|
sql3 = "INSERT INTO _motmComments (_matchDate, opposition, comment) VALUES ('" + _matchDate + "', '" + _oppo + "', '" + _fixed_comments + "')"
|
||||||
#sql_write(sql3)
|
#sql_write(sql3)
|
||||||
#sql_write(sql)
|
#sql_write(sql)
|
||||||
#sql_write(sql2)
|
#sql_write(sql2)
|
||||||
resp = make_response(render_template('_hkfcDVoteThanks.html'))
|
resp = make_response(render_template('_hkfcDVoteThanks.html'))
|
||||||
expire_date = datetime.now()
|
expire_date = datetime.now()
|
||||||
expire_date = expire_date + timedelta(days=90)
|
expire_date = expire_date + timedelta(days=90)
|
||||||
|
resp.set_cookie('sessionID', identity, expires=expire_date)
|
||||||
resp.set_cookie('sessionID', identity, expires=expire_date)
|
return resp
|
||||||
return resp
|
|
||||||
else:
|
else:
|
||||||
return 'Ouch ... something went wrong here'
|
return 'Ouch ... something went wrong here'
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user