From 916beedbb821741a447ddae6dfe2ea7007ddb1b6 Mon Sep 17 00:00:00 2001 From: puls200 Date: Fri, 29 Sep 2023 14:22:04 +0200 Subject: [PATCH] =?UTF-8?q?added=20evaluation=20and=20evaluation=5Fmessage?= =?UTF-8?q?=20to=20shipcall=20(f=C3=BCr=20die=20Ampel)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- misc/BreCalApi.yaml | 6 ++++++ misc/create_schema.sql | 2 ++ src/server/BreCal/impl/shipcalls.py | 10 +++++++++- src/server/BreCal/schemas/model.py | 4 ++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml index cb8acfc..0728e1b 100644 --- a/misc/BreCalApi.yaml +++ b/misc/BreCalApi.yaml @@ -404,6 +404,12 @@ components: canceled: type: boolean nullable: true + evaluation: + type: integer + nullable: true + evaluation_message: + type: string + nullable: true participants: type: array items: diff --git a/misc/create_schema.sql b/misc/create_schema.sql index dfa0cf1..267b60d 100644 --- a/misc/create_schema.sql +++ b/misc/create_schema.sql @@ -198,6 +198,8 @@ CREATE TABLE `shipcall` ( `recommended_tugs` int DEFAULT '0', `anchored` bit(1) DEFAULT NULL, `moored_lock` bit(1) DEFAULT NULL, + `evaluation` int DEFAULT NULL, + `evaluation_message` varchar(512) DEFAULT NULL, `canceled` bit(1) DEFAULT NULL, `created` datetime DEFAULT CURRENT_TIMESTAMP, `modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, diff --git a/src/server/BreCal/impl/shipcalls.py b/src/server/BreCal/impl/shipcalls.py index 2a61951..fdf0b78 100644 --- a/src/server/BreCal/impl/shipcalls.py +++ b/src/server/BreCal/impl/shipcalls.py @@ -19,7 +19,7 @@ def GetShipcalls(options): commands = pydapper.using(pooledConnection) data = commands.query("SELECT id, ship_id, type, eta, voyage, etd, arrival_berth_id, departure_berth_id, tug_required, pilot_required, " + "flags, pier_side, bunkering, replenishing_terminal, replenishing_lock, draft, tidal_window_from, tidal_window_to, rain_sensitive_cargo, recommended_tugs, " + - "anchored, moored_lock, canceled, created, modified FROM shipcall WHERE eta IS NULL OR eta >= DATE(NOW() - INTERVAL 2 DAY) " + + "anchored, moored_lock, canceled, evaluation, evaluation_message, created, modified FROM shipcall WHERE eta IS NULL OR eta >= DATE(NOW() - INTERVAL 2 DAY) " + "ORDER BY eta", model=model.Shipcall) for shipcall in data: participant_query = "SELECT participant_id FROM shipcall_participant_map WHERE shipcall_id=?shipcall_id?"; @@ -63,6 +63,10 @@ def PostShipcalls(schemaModel): continue if key == "modified": continue + if key == "evaluation": + continue + if key == "evaluation_message": + continue if isNotFirst: query += "," isNotFirst = True @@ -137,6 +141,10 @@ def PutShipcalls(schemaModel): continue if key == "modified": continue + if key == "evaluation": + continue + if key == "evaluation_message": + continue if isNotFirst: query += ", " isNotFirst = True diff --git a/src/server/BreCal/schemas/model.py b/src/server/BreCal/schemas/model.py index 9671492..b1f1300 100644 --- a/src/server/BreCal/schemas/model.py +++ b/src/server/BreCal/schemas/model.py @@ -85,6 +85,8 @@ class ShipcallSchema(Schema): anchored = fields.Bool(Required = False, allow_none=True) moored_lock = fields.Bool(Required = False, allow_none=True) canceled = fields.Bool(Required = False, allow_none=True) + evaluation = fields.Int(Required = False, allow_none=True) + evaluation_message = fields.Str(Required = False, allow_none=True) participants = fields.List(fields.Int) created = fields.DateTime(Required = False, allow_none=True) modified = fields.DateTime(Required = False, allow_none=True) @@ -115,6 +117,8 @@ class Shipcall: anchored: bool moored_lock: bool canceled: bool + evaluation: int + evaluation_message: str created: datetime modified: datetime participants: List[int] = field(default_factory=list)