Skip to content

Commit

Permalink
fixed statistical level error
Browse files Browse the repository at this point in the history
  • Loading branch information
liangzai006 committed Sep 22, 2023
1 parent c6e49e4 commit 1d41269
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/controllers/inspectresult_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

0 comments on commit 1d41269

Please sign in to comment.