From c7371a945ab6fc3d93e6bd6ad9359a9fb98f4c14 Mon Sep 17 00:00:00 2001 From: Max Metz Date: Wed, 4 Sep 2024 12:21:22 +0200 Subject: [PATCH] adapting traffic light validation 0002-C. This no longer requires ETA verification. Adapted the description when the error occurs and renamed the function. --- .../validators/validation_rule_functions.py | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/server/BreCal/validators/validation_rule_functions.py b/src/server/BreCal/validators/validation_rule_functions.py index ae3e3bc..b035345 100644 --- a/src/server/BreCal/validators/validation_rule_functions.py +++ b/src/server/BreCal/validators/validation_rule_functions.py @@ -27,7 +27,7 @@ error_message_dict = { # 0002 A+B+C "validation_rule_fct_shipcall_incoming_participants_disagree_on_eta":"There are deviating times between agency, mooring, port authority, pilot and tug for the estimated time of arrival (ETA) {Rule #0002A}", "validation_rule_fct_shipcall_outgoing_participants_disagree_on_etd":"There are deviating times between agency, mooring, port authority, pilot and tug for the estimated time of departure (ETD) {Rule #0002B}", - "validation_rule_fct_shipcall_shifting_participants_disagree_on_eta_or_etd":"There are deviating times between agency, mooring, port authority, pilot and tug for ETA and ETD {Rule #0002C}", + "validation_rule_fct_shipcall_shifting_participants_disagree_on_etd":"There are deviating times between agency, mooring, port authority, pilot and tug for the estimated time of departure (ETD) {Rule #0002C}", # 0003 A+B "validation_rule_fct_eta_time_not_in_operation_window":"The estimated time of arrival will be AFTER the planned start of operations. {Rule #0003A}", @@ -723,21 +723,13 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): else: return self.get_no_violation_default_output() - def validation_rule_fct_shipcall_shifting_participants_disagree_on_eta_or_etd(self, shipcall, df_times, *args, **kwargs): + def validation_rule_fct_shipcall_shifting_participants_disagree_on_etd(self, shipcall, df_times, *args, **kwargs): """ Code: #0002-C Type: Local Rule - Description: this validation checks, whether the participants expect different ETA or ETD times + Description: this validation checks, whether the participants expect different ETD times Filter: only applies to shifting shipcalls """ - violation_state_eta = self.check_participants_agree_on_estimated_time( - shipcall = shipcall, - - query="eta_berth", - df_times=df_times, - applicable_shipcall_type=ShipcallType.SHIFTING - ) - violation_state_etd = self.check_participants_agree_on_estimated_time( shipcall = shipcall, @@ -746,16 +738,14 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): applicable_shipcall_type=ShipcallType.SHIFTING ) - # apply 'eta_berth' check # apply 'etd_berth' - # violation: if either 'eta_berth' or 'etd_berth' is violated + # violation: if either 'etd_berth' is violated # functionally, this is the same as individually comparing all times for the participants - # times_agency.eta_berth==times_mooring.eta_berth==times_portadministration.eta_berth==times_pilot.eta_berth==times_tug.eta_berth # times_agency.etd_berth==times_mooring.etd_berth==times_portadministration.etd_berth==times_pilot.etd_berth==times_tug.etd_berth - violation_state = (violation_state_eta) or (violation_state_etd) + violation_state = (violation_state_etd) if violation_state: - validation_name = "validation_rule_fct_shipcall_shifting_participants_disagree_on_eta_or_etd" + validation_name = "validation_rule_fct_shipcall_shifting_participants_disagree_on_etd" return (StatusFlags.RED, validation_name) else: return self.get_no_violation_default_output()