adding shipcall and times_full stub, which will be used in validation rule testing. Creating blank files/folders for schema_validation (input validation based on simple input rules) and validation_rules (query validation based on complex rules for the traffic-light system)

This commit is contained in:
max_metz 2023-09-08 18:09:38 +02:00
parent a4b70006f9
commit e6bba9a601
6 changed files with 57 additions and 4 deletions

View File

@ -13,13 +13,12 @@ def get_ship_simple():
is_tug = False
bollard_pull = None # only if is_tug
participant_id = None # only if is_tug
eni = "01234567" # Alternative to IMO. Dynamic assertion?. assert len(str(eni))==8
eni = "01234567" # Alternative to IMO. Dynamic assertion? assert len(str(eni))==8
created = datetime.datetime.now()
modified = created+datetime.timedelta(seconds=10)
deleted = modified+datetime.timedelta(seconds=3)
ship = Ship(
ship_id,
name,

View File

@ -4,6 +4,7 @@ from BreCal.schemas.model import Shipcall
from dataclasses import field
def get_shipcall_simple():
# only used for the stub
base_time = datetime.datetime.now()
shipcall_id = generate_uuid1_int()
@ -21,7 +22,7 @@ def get_shipcall_simple():
pilot_required = False
flags = 0 # #TODO_shipcall_flags. What is meant here? What should be tested?
pier_side = False # whether a ship will be fixated on the pier side. en: pier side, de: Anlegestelle
pier_side = False # whether a ship will be fixated on the pier side. en: pier side, de: Anlegestelle. From 'BremenCalling_Datenmodell.xlsx': gedreht/ungedreht
bunkering = False # #TODO_bunkering_unclear
replenishing_terminal = False # en: replenishing terminal, de: Nachfüll-Liegeplatz
replenishing_lock = False # en: replenishing lock, de: Nachfüllschleuse
@ -71,6 +72,6 @@ def get_shipcall_simple():
modified,
participants,
)
return Shipcall
return shipcall

View File

@ -2,4 +2,57 @@
this stub creates an example time object, where the times of every role are present.
users will thereby be able to modify these values
"""
import datetime
from brecal_utils.stubs import generate_uuid1_int
from BreCal.schemas.model import Times
def get_times_full_simple():
# only used for the stub
base_time = datetime.datetime.now()
# note 1: eta and etd should never individually be in reverse order. assert etd>eta (for berth) & lock
# note 2: times are currently computed as a sequence of (eta_berth -> lock_time -> etd_berth -> zone_entry). The deltas are arbitrary
times_id = generate_uuid1_int()
eta_berth = base_time+datetime.timedelta(hours=1, minutes=12)
eta_berth_fixed = False
lock_time = eta_berth+datetime.timedelta(hours=0, minutes=50)
lock_time_fixed = False
etd_berth = lock_time+datetime.timedelta(hours=0, minutes=45)
etd_berth_fixed = False
zone_entry = etd_berth+datetime.timedelta(hours=0, minutes=15)
zone_entry_fixed = False
operations_start = zone_entry+datetime.timedelta(hours=1, minutes=30)
operations_end = operations_start+datetime.timedelta(hours=4, minutes=30)
remarks = "" # assert len(remarks)<{max_len_threshold}
participant_id = generate_uuid1_int()
shipcall_id = generate_uuid1_int()
created = datetime.datetime.now()
modified = created+datetime.timedelta(seconds=10)
times = Times(
times_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,
participant_id,
shipcall_id,
created,
modified,
)
return times