From c36e9134725d84abccbf66103f4f0e79c8bfde09 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 28 Nov 2023 11:23:46 +0100 Subject: [PATCH] added trace output and fixed a bug when saving shipcalls without times --- src/server/BreCal/database/sql_handler.py | 2 ++ src/server/BreCal/impl/shipcalls.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/BreCal/database/sql_handler.py b/src/server/BreCal/database/sql_handler.py index f34f345..c228e8c 100644 --- a/src/server/BreCal/database/sql_handler.py +++ b/src/server/BreCal/database/sql_handler.py @@ -218,6 +218,8 @@ class SQLHandler(): def get_times_of_shipcall(self, shipcall)->pd.DataFrame: df_times = self.df_dict.get('times') # -> pd.DataFrame + if df_times is None: + return None df_times = df_times.loc[df_times["shipcall_id"]==shipcall.id] return df_times diff --git a/src/server/BreCal/impl/shipcalls.py b/src/server/BreCal/impl/shipcalls.py index dd9cc3f..452a8be 100644 --- a/src/server/BreCal/impl/shipcalls.py +++ b/src/server/BreCal/impl/shipcalls.py @@ -1,6 +1,6 @@ import json import logging - +import traceback import pydapper from ..schemas import model @@ -36,6 +36,7 @@ def GetShipcalls(options): pooledConnection.close() except Exception as ex: + logging.error(traceback.format_exc()) logging.error(ex) print(ex) result = {} @@ -115,6 +116,7 @@ def PostShipcalls(schemaModel): return json.dumps({"id" : new_id}), 201, {'Content-Type': 'application/json; charset=utf-8'} except Exception as ex: + logging.error(traceback.format_exc()) logging.error(ex) print(ex) result = {} @@ -199,6 +201,7 @@ def PutShipcalls(schemaModel): return json.dumps({"id" : schemaModel["id"]}), 200 except Exception as ex: + logging.error(traceback.format_exc()) logging.error(ex) print(ex) result = {}