diff --git a/src/server/BreCal/validators/validation_rule_functions.py b/src/server/BreCal/validators/validation_rule_functions.py index a8138ab..478a7cf 100644 --- a/src/server/BreCal/validators/validation_rule_functions.py +++ b/src/server/BreCal/validators/validation_rule_functions.py @@ -268,7 +268,7 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): - Measures the difference between 'now' and 'times_agency.eta_berth'. """ # check, if the header is filled in (agency & MOORING) - if len(df_times.loc[df_times["participant_type"].isin([ParticipantType.AGENCY.value, ParticipantType.MOORING.value])]) != 2: + if (len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1) or (len(df_times.loc[df_times["participant_type"]==ParticipantType.MOORING.value]) != 1): return self.get_no_violation_default_output() # preparation: obtain the correct times of the participant, define the query time and the key time @@ -298,7 +298,7 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): - Measures the difference between 'now' and 'times_agency.etd_berth'. """ # check, if the header is filled in (agency & MOORING) - if len(df_times.loc[df_times["participant_type"].isin([ParticipantType.AGENCY.value, ParticipantType.MOORING.value])]) != 2: + if (len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1) or (len(df_times.loc[df_times["participant_type"]==ParticipantType.MOORING.value]) != 1): return self.get_no_violation_default_output() # preparation: obtain the correct times of the participant, define the query time and the key time @@ -328,7 +328,7 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): - Measures the difference between 'now' and 'times_agency.eta_berth'. """ # check, if the header is filled in (agency & PORT_ADMINISTRATION) - if len(df_times.loc[df_times["participant_type"].isin([ParticipantType.AGENCY.value, ParticipantType.PORT_ADMINISTRATION.value])]) != 2: + if (len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1) or (len(df_times.loc[df_times["participant_type"]==ParticipantType.PORT_ADMINISTRATION.value]) != 1): return self.get_no_violation_default_output() # preparation: obtain the correct times of the participant, define the query time and the key time @@ -358,7 +358,7 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): - Measures the difference between 'now' and 'times_agency.etd_berth'. """ # check, if the header is filled in (agency & PORT_ADMINISTRATION) - if len(df_times.loc[df_times["participant_type"].isin([ParticipantType.AGENCY.value, ParticipantType.PORT_ADMINISTRATION.value])]) != 2: + if (len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1) or (len(df_times.loc[df_times["participant_type"]==ParticipantType.PORT_ADMINISTRATION.value]) != 1): return self.get_no_violation_default_output() # preparation: obtain the correct times of the participant, define the query time and the key time @@ -388,7 +388,7 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): - Measures the difference between 'now' and 'times_agency.eta_berth'. """ # check, if the header is filled in (agency & PILOT) - if len(df_times.loc[df_times["participant_type"].isin([ParticipantType.AGENCY.value, ParticipantType.PILOT.value])]) != 2: + if (len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1) or (len(df_times.loc[df_times["participant_type"]==ParticipantType.PILOT.value]) != 1): return self.get_no_violation_default_output() # preparation: obtain the correct times of the participant, define the query time and the key time @@ -418,7 +418,7 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): - Measures the difference between 'now' and 'times_agency.etd_berth'. """ # check, if the header is filled in (agency & PILOT) - if len(df_times.loc[df_times["participant_type"].isin([ParticipantType.AGENCY.value, ParticipantType.PILOT.value])]) != 2: + if (len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1) or (len(df_times.loc[df_times["participant_type"]==ParticipantType.PILOT.value]) != 1): return self.get_no_violation_default_output() # preparation: obtain the correct times of the participant, define the query time and the key time @@ -448,7 +448,7 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): - Measures the difference between 'now' and 'times_agency.eta_berth'. """ # check, if the header is filled in (agency & TUG) - if len(df_times.loc[df_times["participant_type"].isin([ParticipantType.AGENCY.value, ParticipantType.TUG.value])]) != 2: + if (len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1) or (len(df_times.loc[df_times["participant_type"]==ParticipantType.TUG.value]) != 1): return self.get_no_violation_default_output() # preparation: obtain the correct times of the participant, define the query time and the key time @@ -478,7 +478,7 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): - Measures the difference between 'now' and 'times_agency.etd_berth'. """ # check, if the header is filled in (agency & TUG) - if len(df_times.loc[df_times["participant_type"].isin([ParticipantType.AGENCY.value, ParticipantType.TUG.value])]) != 2: + if (len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1) or (len(df_times.loc[df_times["participant_type"]==ParticipantType.TUG.value]) != 1): return self.get_no_violation_default_output() # preparation: obtain the correct times of the participant, define the query time and the key time @@ -508,10 +508,7 @@ class ValidationRuleFunctions(ValidationRuleBaseFunctions): - Measures the difference between 'now' and 'times_agency.eta_berth'. """ # check, if the header is filled in (agency & terminal) - if len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1: - return self.get_no_violation_default_output() # rule not applicable - - if len(df_times.loc[df_times["participant_type"]==ParticipantType.TERMINAL.value]) != 1: + if (len(df_times.loc[df_times["participant_type"]==ParticipantType.AGENCY.value]) != 1) or (len(df_times.loc[df_times["participant_type"]==ParticipantType.TERMINAL.value]) != 1): return self.get_no_violation_default_output() # rule not applicable # preparation: obtain the correct times of the participant, define the query time and the key time