From 834da84786f690ed3b069bb2d6d510cf4db5886c Mon Sep 17 00:00:00 2001 From: scopesorting Date: Tue, 28 Nov 2023 14:26:38 +0100 Subject: [PATCH] minot adjustments & refactoring --- src/server/BreCal/validators/validation_rules.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/server/BreCal/validators/validation_rules.py b/src/server/BreCal/validators/validation_rules.py index febbff4..ba808e8 100644 --- a/src/server/BreCal/validators/validation_rules.py +++ b/src/server/BreCal/validators/validation_rules.py @@ -46,15 +46,9 @@ class ValidationRules(ValidationRuleFunctions): # 'translate' all error codes into readable, human-understandable format. evaluation_results = [(state, self.describe_error_message(msg)) for (state, msg) in evaluation_results] - - """ # deprecated - # check, if ANY of the evaluation results (evaluation_state) is larger than the .GREEN state. This means, that .YELLOW and .RED - # would return 'True'. Numpy arrays and functions are used to accelerate the comparison. - # np.any returns a boolean. - #evaluation_state = not np.any(np.greater(np.array([result[0] for result in evaluation_results]), ValidationRuleState.GREEN)) - """ + # check, what the maximum state flag is and return it - evaluation_state = np.max(np.array([result[0].value for result in evaluation_results])) if len(evaluation_results)>0 else 1 + evaluation_state = np.max(np.array([result[0].value for result in evaluation_results])) if len(evaluation_results)>0 else StatusFlags.GREEN.value evaluation_verbosity = [result[1] for result in evaluation_results] return (evaluation_state, evaluation_verbosity)