From 1d412695f519786c2b1f9aa6101d4ef25d21c533 Mon Sep 17 00:00:00 2001 From: Xiao Liu <46879761+liangzai006@users.noreply.github.com> Date: Fri, 22 Sep 2023 12:18:57 +0800 Subject: [PATCH] fixed statistical level error --- pkg/controllers/inspectresult_controller.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/controllers/inspectresult_controller.go b/pkg/controllers/inspectresult_controller.go index 083f42df..75ff3e38 100644 --- a/pkg/controllers/inspectresult_controller.go +++ b/pkg/controllers/inspectresult_controller.go @@ -157,7 +157,9 @@ func (r *InspectResultReconciler) CountLevelNum(resultName string) (map[kubeeyev } levelTotal := make(map[kubeeyev1alpha2.Level]*int) - + levelTotal[kubeeyev1alpha2.DangerLevel] = &result.Spec.OpaResult.Dangerous + levelTotal[kubeeyev1alpha2.WarningLevel] = &result.Spec.OpaResult.Warning + levelTotal[kubeeyev1alpha2.IgnoreLevel] = &result.Spec.OpaResult.Ignore ComputeLevel(result.Spec.FileChangeResult, levelTotal) ComputeLevel(result.Spec.FileFilterResult, levelTotal) @@ -172,9 +174,5 @@ func (r *InspectResultReconciler) CountLevelNum(resultName string) (map[kubeeyev ComputeLevel(result.Spec.ComponentResult, levelTotal) - levelTotal[kubeeyev1alpha2.DangerLevel] = &result.Spec.OpaResult.Dangerous - levelTotal[kubeeyev1alpha2.WarningLevel] = &result.Spec.OpaResult.Warning - levelTotal[kubeeyev1alpha2.IgnoreLevel] = &result.Spec.OpaResult.Ignore - return levelTotal, nil }