From 836c1aa802da80bbfca34dcfe5aa076a86f8007d Mon Sep 17 00:00:00 2001 From: scopesorting Date: Tue, 28 Nov 2023 14:17:07 +0100 Subject: [PATCH] fixing the 'KeyError' when using an empty times dataframe. Returning 'green' --- src/server/BreCal/validators/validation_rules.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/server/BreCal/validators/validation_rules.py b/src/server/BreCal/validators/validation_rules.py index aa2ef22..932040a 100644 --- a/src/server/BreCal/validators/validation_rules.py +++ b/src/server/BreCal/validators/validation_rules.py @@ -39,6 +39,9 @@ class ValidationRules(ValidationRuleFunctions): if len(spm.loc[spm["shipcall_id"]==shipcall.id])==0: return (StatusFlags.GREEN.value, []) + if len(df_times)==0: + return (StatusFlags.GREEN.value, []) + # filter by shipcall id df_times = self.sql_handler.get_times_of_shipcall(shipcall)