From c6bbbf94e33a8a8469c5f60b6e6d76c00350987e Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 14 Feb 2024 16:24:06 +0100 Subject: [PATCH] do not use execute_scalar --- src/server/BreCal/impl/shipcalls.py | 2 +- src/server/BreCal/impl/times.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/BreCal/impl/shipcalls.py b/src/server/BreCal/impl/shipcalls.py index 82ff2a0..3c50081 100644 --- a/src/server/BreCal/impl/shipcalls.py +++ b/src/server/BreCal/impl/shipcalls.py @@ -126,7 +126,7 @@ def PostShipcalls(schemaModel): # TODO: set ETA properly 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, 1, 1)" - commands.execute_scalar(query, {"scid" : new_id, "pid" : user_data["participant_id"], "uid" : user_data["id"]}) + commands.execute(query, {"scid" : new_id, "pid" : user_data["participant_id"], "uid" : user_data["id"]}) return json.dumps({"id" : new_id}), 201, {'Content-Type': 'application/json; charset=utf-8'} diff --git a/src/server/BreCal/impl/times.py b/src/server/BreCal/impl/times.py index 31bfd26..9ea67c7 100644 --- a/src/server/BreCal/impl/times.py +++ b/src/server/BreCal/impl/times.py @@ -90,7 +90,7 @@ def PostTimes(schemaModel): # TODO: set ETA properly 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, 1)" - commands.execute_scalar(query, {"scid" : schemaModel["shipcall_id"], "pid" : user_data["participant_id"], "uid" : user_data["id"]}) + commands.execute(query, {"scid" : schemaModel["shipcall_id"], "pid" : user_data["participant_id"], "uid" : user_data["id"]}) return json.dumps({"id" : new_id}), 201, {'Content-Type': 'application/json; charset=utf-8'} @@ -144,7 +144,7 @@ def PutTimes(schemaModel): # TODO: set ETA properly 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)" - commands.execute_scalar(query, {"scid" : schemaModel["shipcall_id"], "pid" : user_data["participant_id"], "uid" : user_data["id"]}) + commands.query(query, {"scid" : schemaModel["shipcall_id"], "pid" : user_data["participant_id"], "uid" : user_data["id"]}) # if affected_rows == 1: # this doesn't work as expected @@ -180,7 +180,7 @@ def DeleteTimes(options): # 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_scalar(query, {"pid" : user_data["participant_id"], "uid" : user_data["id"]}) + commands.execute(query, {"pid" : user_data["participant_id"], "uid" : user_data["id"]}) if affected_rows == 1: return json.dumps({"id" : options["id"]}), 200, {'Content-Type': 'application/json; charset=utf-8'}