added ata_atd and time_point_ref fields to database, yaml and python access layer
This commit is contained in:
parent
862ef9fe88
commit
f311d75c73
@ -562,6 +562,10 @@ components:
|
||||
maxLength: 512
|
||||
type: string
|
||||
nullable: true
|
||||
time_ref_point:
|
||||
type: integer
|
||||
nullable: true
|
||||
description: Physical reference point for all times given in shipcall and depending times entries
|
||||
participants:
|
||||
type: array
|
||||
items:
|
||||
@ -660,6 +664,11 @@ components:
|
||||
nullable: true
|
||||
participant_type:
|
||||
type: integer
|
||||
ata_atd:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
description: can be set by mooring if actual times are different from planned
|
||||
created:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
ALTER TABLE `bremen_calling_devel`.`shipcall`
|
||||
ADD COLUMN `evaluation_time` DATETIME NULL DEFAULT NULL AFTER `evaluation_message`,
|
||||
ADD COLUMN `evaluation_notifications_sent` BIT NULL AFTER `evaluation_time`;
|
||||
|
||||
ADD COLUMN `evaluation_notifications_sent` BIT NULL AFTER `evaluation_time`,
|
||||
ADD COLUMN `time_ref_point` INT NULL DEFAULT 0 COMMENT 'Index of a location which is the reference point for all time value entries, e.g. berth or Geeste' AFTER `modified`;
|
||||
|
||||
|
||||
-- prepare notification table for historic notification data
|
||||
@ -85,3 +85,8 @@ ADD CONSTRAINT `FK_HISTORY_USER`
|
||||
REFERENCES `bremen_calling_devel`.`user` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION;
|
||||
|
||||
-- add ata_atd field to times
|
||||
|
||||
ALTER TABLE `bremen_calling_devel`.`times`
|
||||
ADD COLUMN `ata_atd` DATETIME NULL DEFAULT NULL COMMENT 'Relevant only for mooring, this field can be used to record actual ATA / ATD' AFTER `participant_type`;
|
||||
@ -21,7 +21,7 @@ def GetShipcalls(options):
|
||||
query = ("SELECT s.id as id, ship_id, type, eta, voyage, etd, arrival_berth_id, departure_berth_id, tug_required, pilot_required, " +
|
||||
"flags, s.pier_side, bunkering, replenishing_terminal, replenishing_lock, draft, tidal_window_from, " +
|
||||
"tidal_window_to, rain_sensitive_cargo, recommended_tugs, anchored, moored_lock, canceled, evaluation, " +
|
||||
"evaluation_message, evaluation_time, evaluation_notifications_sent, s.created as created, s.modified as modified " +
|
||||
"evaluation_message, evaluation_time, evaluation_notifications_sent, s.created as created, s.modified as modified, time_ref_point " +
|
||||
"FROM shipcall s " +
|
||||
"LEFT JOIN times t ON t.shipcall_id = s.id AND t.participant_type = 8 " +
|
||||
"WHERE " +
|
||||
|
||||
@ -22,7 +22,7 @@ def GetTimes(options):
|
||||
commands = pydapper.using(pooledConnection)
|
||||
data = commands.query("SELECT id, eta_berth, eta_berth_fixed, etd_berth, etd_berth_fixed, lock_time, lock_time_fixed, " +
|
||||
"zone_entry, zone_entry_fixed, operations_start, operations_end, remarks, shipcall_id, participant_id, " +
|
||||
"berth_id, berth_info, pier_side, participant_type, created, modified FROM times " +
|
||||
"berth_id, berth_info, pier_side, participant_type, created, modified, ata_atd FROM times " +
|
||||
"WHERE times.shipcall_id = ?scid?", model=model.Times, param={"scid" : options["shipcall_id"]})
|
||||
pooledConnection.close()
|
||||
|
||||
|
||||
@ -176,6 +176,7 @@ class ShipcallSchema(Schema):
|
||||
evaluation_message = fields.Str(allow_none=True, metadata={'Required':False}) # Solving: RemovedInMarshmallow4Warning: Passing field metadata as keyword arguments is deprecated. Use the explicit `metadata=...` argument instead. Additional metadata: {'Required': False}
|
||||
evaluation_time = fields.DateTime(Required = False, allow_none=True)
|
||||
evaluation_notifications_sent = fields.Bool(Required = False, allow_none=True)
|
||||
time_ref_point = fields.Int(Required = False, allow_none=True)
|
||||
participants = fields.List(fields.Nested(ParticipantAssignmentSchema))
|
||||
created = fields.DateTime(Required = False, allow_none=True)
|
||||
modified = fields.DateTime(Required = False, allow_none=True)
|
||||
@ -221,6 +222,7 @@ class Shipcall:
|
||||
evaluation_message: str
|
||||
evaluation_time: datetime
|
||||
evaluation_notifications_sent: bool
|
||||
time_ref_point: int
|
||||
created: datetime
|
||||
modified: datetime
|
||||
participants: List[Participant_Assignment] = field(default_factory=list)
|
||||
@ -254,6 +256,7 @@ class Shipcall:
|
||||
"evaluation_message": self.evaluation_message,
|
||||
"evaluation_time": self.evaluation_time.isoformat() if self.evaluation_time else "",
|
||||
"evaluation_notifications_sent": self.evaluation_notifications_sent,
|
||||
"time_ref_point": self.time_ref_point,
|
||||
"created": self.created.isoformat() if self.created else "",
|
||||
"modified": self.modified.isoformat() if self.modified else "",
|
||||
"participants": [participant.__dict__ for participant in self.participants]
|
||||
@ -262,8 +265,8 @@ class Shipcall:
|
||||
|
||||
|
||||
@classmethod
|
||||
def from_query_row(self, 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, evaluation, evaluation_message, evaluation_time, evaluation_notifications_sent, created, modified):
|
||||
return self(id, ship_id, ShipcallType(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, EvaluationType(evaluation), evaluation_message, evaluation_time, evaluation_notifications_sent, created, modified)
|
||||
def from_query_row(self, 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, evaluation, evaluation_message, evaluation_time, evaluation_notifications_sent, time_ref_point, created, modified):
|
||||
return self(id, ship_id, ShipcallType(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, EvaluationType(evaluation), evaluation_message, evaluation_time, evaluation_notifications_sent, time_ref_point, created, modified)
|
||||
|
||||
class ShipcallId(Schema):
|
||||
pass
|
||||
@ -293,6 +296,7 @@ class TimesSchema(Schema):
|
||||
pier_side = fields.Bool(Required = False, allow_none = True)
|
||||
shipcall_id = fields.Int(Required = True)
|
||||
participant_type = fields.Int(Required = False, allow_none=True)
|
||||
ata_atd = fields.DateTime(Required = False, allow_none=True)
|
||||
created = fields.DateTime(Required = False, allow_none=True)
|
||||
modified = fields.DateTime(Required = False, allow_none=True)
|
||||
|
||||
@ -330,6 +334,7 @@ class Times:
|
||||
pier_side: bool
|
||||
participant_type: int
|
||||
shipcall_id: int
|
||||
ata_atd: datetime
|
||||
created: datetime
|
||||
modified: datetime
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user