added existence check to dictionary key usage
This commit is contained in:
parent
e8f6a17e7f
commit
b47c261487
@ -143,8 +143,11 @@ def PutTimes(schemaModel):
|
|||||||
# save history data
|
# save history data
|
||||||
# TODO: set ETA properly
|
# TODO: set ETA properly
|
||||||
user_data = check_jwt()
|
user_data = check_jwt()
|
||||||
query = "INSERT INTO history (participant_id, shipcall_id, user_id, timestamp, eta, type, operation) VALUES (?pid?, ?scid?, ?uid?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 2, 2)"
|
if "participant_id" in user_data and "id" in user_data:
|
||||||
commands.query(query, {"pid" : user_data["participant_id"], "scid" : schemaModel["shipcall_id"], "uid" : user_data["id"]})
|
query = "INSERT INTO history (participant_id, shipcall_id, user_id, timestamp, eta, type, operation) VALUES (?pid?, ?scid?, ?uid?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 2, 2)"
|
||||||
|
commands.execute(query, {"pid" : user_data["participant_id"], "scid" : schemaModel["shipcall_id"], "uid" : user_data["id"]})
|
||||||
|
else:
|
||||||
|
logging.error("user_data does not contain participant_id or id")
|
||||||
|
|
||||||
# if affected_rows == 1: # this doesn't work as expected
|
# if affected_rows == 1: # this doesn't work as expected
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user