added evaluation and evaluation_message to shipcall (für die Ampel)

This commit is contained in:
Daniel Schick 2023-09-29 14:22:04 +02:00
parent 197048aa8b
commit 916beedbb8
4 changed files with 21 additions and 1 deletions

View File

@ -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:

View File

@ -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,

View File

@ -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

View File

@ -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)