diff --git a/src/server/BreCal/impl/times.py b/src/server/BreCal/impl/times.py index b7b7dcb..ab4786d 100644 --- a/src/server/BreCal/impl/times.py +++ b/src/server/BreCal/impl/times.py @@ -175,15 +175,15 @@ def DeleteTimes(options): pooledConnection = local_db.getPoolConnection() commands = pydapper.using(pooledConnection) + shipcall_id = commands.execute_scalar("SELECT shipcall_id FROM times WHERE id = ?id?", param={"id" : options["id"]}) affected_rows = commands.execute("DELETE FROM times WHERE id = ?id?", param={"id" : options["id"]}) - - # TODO: howto get the shipcall id here? we will need to load the object first - # TODO: set ETA properly + + # TODO: set ETA properly? # save history data user_data = check_jwt() - query = "INSERT INTO history (participant_id, shipcall_id, user_id, timestamp, eta, type, operation) VALUES (?pid?, 0, ?uid?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 2, 3)" - commands.execute(query, {"pid" : user_data["participant_id"], "uid" : user_data["id"]}) + query = "INSERT INTO history (participant_id, shipcall_id, user_id, timestamp, eta, type, operation) VALUES (?pid?, ?shipcall_id?, ?uid?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 2, 3)" + commands.execute(query, {"pid" : user_data["participant_id"], "shipcall_id" : shipcall_id, "uid" : user_data["id"]}) if affected_rows == 1: return json.dumps({"id" : options["id"]}), 200, {'Content-Type': 'application/json; charset=utf-8'}