Merge pull request #39 from puls200/hotfix/20240827

Hotfix/20240827
This commit is contained in:
Daniel Schick 2024-08-28 10:24:21 +02:00 committed by GitHub
commit 231c9f86c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 15 deletions

View File

@ -11,10 +11,6 @@ class ParticipantType(IntFlag):
PORT_ADMINISTRATION = 32
TUG = 64
@classmethod
def _missing_(cls, value):
return cls.undefined
class ShipcallType(IntEnum):
"""determines the type of a shipcall, as this changes the applicable validation rules"""
undefined = 0
@ -67,6 +63,3 @@ class ParticipantFlag(IntFlag):
undefined = 0
BSMD = 1
@classmethod
def _missing_(cls, value):
return cls.undefined

View File

@ -83,6 +83,7 @@ def PostTimes(schemaModel):
query += "?" + key + "?"
query += ")"
logging.error(f"(/impl/times @86 issue:) query: {query}, schemaModel: {schemaModel}")
commands.execute(query, schemaModel)
new_id = commands.execute_scalar("select last_insert_id()")

View File

@ -27,8 +27,8 @@ def build_post_data_type_dependent_required_fields_dict()->dict[ShipcallType,dic
"""
post_data_type_dependent_required_fields_dict = {
ShipcallType.arrival:{
ParticipantType.undefined:None, # should not be set in POST requests
ParticipantType.BSMD:None, # should not be set in POST requests
ParticipantType.undefined:[], # should not be set in POST requests
ParticipantType.BSMD:[], # should not be set in POST requests
ParticipantType.TERMINAL:["operations_start"],
ParticipantType.AGENCY:["eta_berth"],
ParticipantType.MOORING:["eta_berth"],
@ -37,8 +37,8 @@ def build_post_data_type_dependent_required_fields_dict()->dict[ShipcallType,dic
ParticipantType.TUG:["eta_berth"],
},
ShipcallType.departure:{
ParticipantType.undefined:None, # should not be set in POST requests
ParticipantType.BSMD:None, # should not be set in POST requests
ParticipantType.undefined:[], # should not be set in POST requests
ParticipantType.BSMD:[], # should not be set in POST requests
ParticipantType.TERMINAL:["operations_end"],
ParticipantType.AGENCY:["etd_berth"],
ParticipantType.MOORING:["etd_berth"],
@ -47,8 +47,8 @@ def build_post_data_type_dependent_required_fields_dict()->dict[ShipcallType,dic
ParticipantType.TUG:["etd_berth"],
},
ShipcallType.shifting:{
ParticipantType.undefined:None, # should not be set in POST requests
ParticipantType.BSMD:None, # should not be set in POST requests
ParticipantType.undefined:[], # should not be set in POST requests
ParticipantType.BSMD:[], # should not be set in POST requests
ParticipantType.TERMINAL:["operations_start", "operations_end"],
ParticipantType.AGENCY:["eta_berth", "etd_berth"],
ParticipantType.MOORING:["eta_berth", "etd_berth"],
@ -270,7 +270,8 @@ class InputValidationTimes():
dependent_required_fields_dict = build_post_data_type_dependent_required_fields_dict()
# select shipcall type & participant type
dependent_required_fields = dependent_required_fields_dict.get(shipcall_type,{}).get(participant_type,None)
dependent_required_fields = dependent_required_fields_dict.get(shipcall_type,{}).get(participant_type,[])
dependent_required_fields = dependent_required_fields if dependent_required_fields is not None else []
return dependent_required_fields
@staticmethod

View File

@ -20,7 +20,8 @@ def get_participant_id_dictionary():
# build a dictionary of id:item pairs, so one can select the respective participant
participants = json.loads(response)
participants = {items.get("id"):items for items in participants}
participants = {items.get("id"):{**items, "participant_id":items.get("id")} for items in participants}
assert all(["participant_id" in participant for k,participant in participants.items()])
return participants
def get_berth_id_dictionary():